Created
May 3, 2013 13:33
-
-
Save mmertsock/5509128 to your computer and use it in GitHub Desktop.
BeforeEachExample/AfterEachExample/Afterward mockup for https://github.com/trackabout/speceasy/pulls/1
This file contains 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 MySpec : Spec<SomeClass> | |
{ | |
protected override void BeforeEachExample() | |
{ | |
} | |
protected override void AfterEachExample() | |
{ | |
} | |
public void TestGroup1() | |
{ | |
When("doing something 1", () => SUT.DoSomething1()); | |
Given("condition 1A", () => { | |
// here is where you can run setup for each example in this test group | |
}).Verify(() => { | |
Then("example 1A", () => {}); | |
Given("condition 1B", () => {}).Verify(() => { | |
Then("example 1B", () => {}); | |
}); | |
}).Afterward(() => { | |
// here is where you can run teardown for each example in this test group | |
// Afterwards can be used on nested Givens too. | |
}); | |
} | |
// for example 1A: | |
// BeforeEachExample() | |
// Given condition 1A | |
// Then verify example 1A | |
// Afterward for 1A | |
// AfterEachExample() | |
// for example 1B: | |
// BeforeEachExample() | |
// Given condition 1A | |
// Given condition 1B | |
// Then verify example 1B | |
// Afterward for 1A | |
// AfterEachExample() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment