1- using NUnit . Framework ;
1+ using System ;
2+ using System . Linq ;
3+ using NUnit . Framework ;
24using Shouldly ;
5+ using TestStack . BDDfy . Tests . Configuration ;
36
47namespace TestStack . BDDfy . Tests . Scanner . FluentScanner
58{
@@ -19,5 +22,34 @@ public void ShouldBeAbleToChainComplexTestWithFluentApi()
1922 . And ( ( ) => count ++ . ShouldBe ( 4 ) , "And we should still be able to use ands" )
2023 . BDDfy ( ) ;
2124 }
25+
26+ [ Test ]
27+ public void ShouldContinueExecutingThensButStopWhenNextNotAssertStepIsHit ( )
28+ {
29+ var testRun = new TestRunnerTests . ScenarioWithFailingThen ( )
30+ . Given ( x => x . PassingGiven ( ) )
31+ . When ( x => x . PassingWhen ( ) )
32+ . Then ( x => x . FailingThen ( ) )
33+ . And ( x => x . PassingAndThen ( ) )
34+ . When ( x => x . PassingWhen ( ) )
35+ . LazyBDDfy ( ) ;
36+
37+ Assert . Throws < Exception > ( ( ) => testRun . Run ( ) ) ;
38+ var scenario = testRun . Story . Scenarios . First ( ) ;
39+ Assert . AreEqual ( Result . Failed , scenario . Result ) ;
40+ var steps = scenario . Steps ;
41+
42+ Assert . AreEqual ( 5 , steps . Count ) ;
43+ Assert . AreEqual ( Result . Passed , steps [ 0 ] . Result ) ;
44+ Assert . AreEqual ( ExecutionOrder . SetupState , steps [ 0 ] . ExecutionOrder ) ;
45+ Assert . AreEqual ( Result . Passed , steps [ 1 ] . Result ) ;
46+ Assert . AreEqual ( ExecutionOrder . Transition , steps [ 1 ] . ExecutionOrder ) ;
47+ Assert . AreEqual ( Result . Failed , steps [ 2 ] . Result ) ;
48+ Assert . AreEqual ( ExecutionOrder . Assertion , steps [ 2 ] . ExecutionOrder ) ;
49+ Assert . AreEqual ( Result . Passed , steps [ 3 ] . Result ) ;
50+ Assert . AreEqual ( ExecutionOrder . ConsecutiveAssertion , steps [ 3 ] . ExecutionOrder ) ;
51+ Assert . AreEqual ( Result . NotExecuted , steps [ 4 ] . Result ) ;
52+ Assert . AreEqual ( ExecutionOrder . Transition , steps [ 4 ] . ExecutionOrder ) ;
53+ }
2254 }
2355}
0 commit comments