Skip to content

Commit d27b0eb

Browse files
committed
Added start of examples docs
1 parent b3beccd commit d27b0eb

2 files changed

Lines changed: 36 additions & 6 deletions

File tree

docs/Usage/BDDExamples.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Examples
2+
3+
4+
## Actions as examples
5+
One of the benefits that BDDfy's approach has it its flexibility.
6+
7+
``` csharp
8+
ExampleAction actionToPerform = null;
9+
int valueShouldBe = 0;
10+
var story = this.Given(_ => SomeSetup())
11+
.When(() => actionToPerform)
12+
.Then(_ => ShouldBe(valueShouldBe))
13+
.WithExamples(new ExampleTable("Action to perform", "Value should be")
14+
{
15+
{ new ExampleAction("Do something", () => { _value = 42; }), 42 },
16+
{ new ExampleAction("Do something else", () => { _value = 7; }), 7 }
17+
})
18+
.BDDfy();
19+
```
20+
21+
When run you will get this:
22+
23+
```
24+
Scenario: Can use actions in examples
25+
Given some setup
26+
When <Action to perform>
27+
Then should be <Value should be>
28+
29+
Examples:
30+
| Action to perform | Value should be |
31+
| Do something | 42 |
32+
| Do something else | 7 |
33+
```
34+
35+
This can make your BDD test incredibly flexible and powerful.

src/TestStack.BDDfy.sln

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 14
4-
VisualStudioVersion = 14.0.22310.1
4+
VisualStudioVersion = 14.0.23107.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8F515887-AAB5-4873-8BE9-5AB10685EBCB}"
77
ProjectSection(SolutionItems) = preProject
@@ -21,11 +21,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestStack.BDDfy", "TestStac
2121
EndProject
2222
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestStack.BDDfy.Tests", "TestStack.BDDfy.Tests\TestStack.BDDfy.Tests.csproj", "{357B22FF-84E9-4AB4-AADF-6B9DBB76FB32}"
2323
EndProject
24-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{7AD952C1-F525-437B-965F-C1400ADA34F0}"
25-
ProjectSection(SolutionItems) = preProject
26-
.nuget\packages.config = .nuget\packages.config
27-
EndProjectSection
28-
EndProject
2924
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{2388D556-6292-49BA-B078-1A04377C17A2}"
3025
EndProject
3126
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestStack.BDDfy.Samples", "Samples\TestStack.BDDfy.Samples\TestStack.BDDfy.Samples.csproj", "{9D14B03B-9514-4DD8-9D4B-914A10D7EB59}"

0 commit comments

Comments
 (0)