1+ using System ;
2+ using System . Runtime . CompilerServices ;
3+ using ApprovalTests ;
4+ using Shouldly ;
5+ using TestStack . BDDfy . Reporters ;
6+ using Xunit ;
7+
8+ namespace TestStack . BDDfy . Tests . Scanner . Examples
9+ {
10+ public class FluentWithExamplesAtEnd
11+ {
12+ [ Fact ]
13+ public void FluentCanBeUsedWithExamples ( )
14+ {
15+ var story = this
16+ . Given ( _ => MethodTaking__ExampleIntA__ ( 1 ) , false )
17+ . When ( _ => WhenEmptyMethod ( ) )
18+ . Then ( _ => ThenAllIsGood ( ) )
19+ . BDDfy ( ) ;
20+
21+ var textReporter = new TextReporter ( ) ;
22+ textReporter . Process ( story ) ;
23+ Approvals . Verify ( textReporter . ToString ( ) ) ;
24+ }
25+
26+ // This test crashes BDDfy or causes an infinite loop
27+ [ Fact ]
28+ public void FluentCanBeUsedWithExamplesEndingInANumber ( ) {
29+ var story = this
30+ . Given ( _ => MethodTaking__ExampleInt1__ ( 1 ) , false )
31+ . When ( _ => WhenEmptyMethod ( ) )
32+ . Then ( _ => ThenAllIsGood ( ) )
33+ . BDDfy ( ) ;
34+
35+ var textReporter = new TextReporter ( ) ;
36+ textReporter . Process ( story ) ;
37+ Approvals . Verify ( textReporter . ToString ( ) ) ;
38+ }
39+
40+ private void ThenAllIsGood ( )
41+ {
42+ }
43+
44+ private void WhenEmptyMethod ( )
45+ {
46+ }
47+
48+ // Ending an example name with a number seems to cause problems in BDDfy
49+ private void MethodTaking__ExampleInt1__ ( int exampleInt )
50+ {
51+ exampleInt . ShouldBeInRange ( 1 , 2 ) ;
52+ }
53+
54+ private void MethodTaking__ExampleIntA__ ( int exampleInt ) {
55+ exampleInt . ShouldBeInRange ( 1 , 2 ) ;
56+ }
57+ }
58+ }
0 commit comments