This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Binding] | |
public class CalculatorSteps | |
{ | |
private readonly ScenarioContext scenarioContext; | |
public CalculatorSteps(ScenarioContext scenarioContext) | |
{ | |
this.scenarioContext = scenarioContext; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Given(@"I have entered (.*) into the calculator")] | |
public void GivenIHaveEnteredIntoTheCalculator(int operand) | |
{ | |
((Calculator)ScenarioContext.Current["calc"]).Enter(operand); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Binding] | |
public class CalculatorSteps | |
{ | |
private readonly Calculator calculator = new Calculator(); | |
[Given(@"I have entered (.*) into the calculator")] | |
public void GivenIHaveEnteredIntoTheCalculator(int operand) | |
{ | |
calculator.Enter(operand); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Multiplication | |
Scenario Outline: Add two numbers | |
Given I have entered <a> into the calculator | |
And I have entered <b> into the calculator | |
When I press multiply | |
Then the result should be <result> on the screen | |
Examples: | |
| case | a | b | result | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Addition | |
Scenario Outline: Add two numbers | |
Given I have entered <a> into the calculator | |
And I have entered <b> into the calculator | |
When I press add | |
Then the result should be <result> on the screen | |
Examples: | |
| case | a | b | result | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class TestDependencies | |
{ | |
[ScenarioDependencies] | |
public static ContainerBuilder CreateContainerBuilder() | |
{ | |
// create container with the runtime dependencies | |
var builder = Dependencies.CreateContainerBuilder(); | |
//TODO: add customizations, stubs required for testing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ControllerContext | |
{ | |
public CalculatorController Controller { get; private set; } | |
public ControllerContext() | |
{ | |
var containerBuilder = Dependencies.CreateContainerBuilder(); // invoke runtime dependency configuration | |
//TODO: apply test-specific customizations if needed | |
var container = containerBuilder.Build(); // create container | |
Controller = container.Resolve<CalculatorController>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ControllerContext | |
{ | |
public CalculatorController Controller { get; } = new CalculatorController(); | |
... | |
} | |
[Binding] | |
public class CalculatorSteps | |
{ | |
public CalculatorSteps(ControllerContext controllerContext) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Binding] | |
public class CalculatorSteps | |
{ | |
private readonly CalculatorController controller = new CalculatorController(); | |
... | |
} |