Class Keywords
Experimental: Keywords for building BDD-style tests for clearer source code and state strings. Helps in building tests with consistent style.
Namespace: Responsible.Bdd
Assembly: Responsible.dll
Syntax
public static class Keywords
Fields
Pending
A test instruction representing a BDD test step pending implementation. Will terminate the test as successful early, so that steps after it are skipped. Allows you to quickly write scenarios, and leave the implementation for later.
Declaration
public static readonly ITestInstruction<object> Pending
Field Value
Type | Description |
---|---|
ITestInstruction<Object> |
Methods
And(String, ITestInstruction<Object>)
Creates a step that describes additional steps after a Given, When, or Then.
Declaration
public static IBddStep And(string description, ITestInstruction<object> instruction)
Parameters
Type | Name | Description |
---|---|---|
String | description | Description of the step. |
ITestInstruction<Object> | instruction | Instruction to execute in this step. |
Returns
Type | Description |
---|---|
IBddStep | The given instruction as a BDD test step. |
But(String, ITestInstruction<Object>)
Creates a step that describes additional steps after a Given, When, or Then.
Declaration
public static IBddStep But(string description, ITestInstruction<object> instruction)
Parameters
Type | Name | Description |
---|---|---|
String | description | Description of the step. |
ITestInstruction<Object> | instruction | Instruction to execute in this step. |
Returns
Type | Description |
---|---|
IBddStep | The given instruction as a BDD test step. |
Given(String, ITestInstruction<Object>)
Creates a step that describes the initial context of a test.
Declaration
public static IBddStep Given(string description, ITestInstruction<object> instruction)
Parameters
Type | Name | Description |
---|---|---|
String | description | Description of the step. |
ITestInstruction<Object> | instruction | Instruction to execute in this step. |
Returns
Type | Description |
---|---|
IBddStep | The given instruction as a BDD test step. |
Scenario(String, String, String, Int32)
Starts building a new BDD-style scenario.
Declaration
public static ScenarioBuilder Scenario(string description, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0)
Parameters
Type | Name | Description |
---|---|---|
String | description | Description of the scenario |
String | memberName | Caller member name provided by compiler. May be overridden for custom operators. |
String | sourceFilePath | Caller file path provided by compiler. May be overridden for custom operators. |
Int32 | sourceLineNumber | Source line number provided by compiler. May be overridden for custom operators. |
Returns
Type | Description |
---|---|
ScenarioBuilder | A scenario builder with the given description. |
Then(String, ITestInstruction<Object>)
Creates a step that describes an expected outcome of a test.
Declaration
public static IBddStep Then(string description, ITestInstruction<object> instruction)
Parameters
Type | Name | Description |
---|---|---|
String | description | Description of the step. |
ITestInstruction<Object> | instruction | Instruction to execute in this step. |
Returns
Type | Description |
---|---|
IBddStep | The given instruction as a BDD test step. |
When(String, ITestInstruction<Object>)
Creates a step that describes an event or action in a test. This can be a person interacting with the system, or it can be an event triggered by another system.
Declaration
public static IBddStep When(string description, ITestInstruction<object> instruction)
Parameters
Type | Name | Description |
---|---|---|
String | description | Description of the step. |
ITestInstruction<Object> | instruction | Instruction to execute in this step. |
Returns
Type | Description |
---|---|
IBddStep | The given instruction as a BDD test step. |