77
88namespace Tests . Domain ;
99
10- public class PoemTest ( BasicFixture fixture ) : IClassFixture < BasicFixture >
10+ public class PoemTest : IClassFixture < BasicFixture >
1111{
12+ readonly MetricSettings _metricSettings = new ( ) ;
13+
14+ public PoemTest ( BasicFixture fixture )
15+ {
16+ fixture . Configuration . GetSection ( Constants . METRIC_SETTINGS ) . Bind ( _metricSettings ) ;
17+ }
18+
1219 [ Fact ]
1320 [ Trait ( "UnitTest" , "Computation" ) ]
1421 public void ShouldHaveIntegerDetailedVerseLength ( )
@@ -93,7 +100,7 @@ public void ShouldGenerateExpectedExtraAndMetricTags()
93100 ExtraTags = [ "wonderful" ] ,
94101 VerseLength = "12"
95102 } ;
96- poem . FileContent ( - 1 , fixture . Configuration . GetSection ( Constants . METRIC_SETTINGS ) . Get < MetricSettings > ( ) ! )
103+ poem . FileContent ( - 1 , _metricSettings )
97104 . ShouldContain ( "tags = [\" wonderful\" , \" 2025\" , \" acrostiche\" , \" alexandrin\" ]" ) ;
98105 }
99106
@@ -107,7 +114,7 @@ public void ShouldGenerateExpectedMultipleMetricTags()
107114 TextDate = "01.01.2025" ,
108115 VerseLength = "6, 3"
109116 } ;
110- poem . FileContent ( - 1 , fixture . Configuration . GetSection ( Constants . METRIC_SETTINGS ) . Get < MetricSettings > ( ) ! )
117+ poem . FileContent ( - 1 , _metricSettings )
111118 . ShouldContain ( "tags = [\" 2025\" , \" métrique variable\" , \" hexasyllabe\" , \" trisyllabe\" ]" ) ;
112119 }
113120
@@ -122,7 +129,7 @@ public void ShouldGenerateExpectedLocations()
122129 VerseLength = "8" ,
123130 Locations = [ "Ici" , "Là" , "ailleurs" ]
124131 } ;
125- poem . FileContent ( - 1 , fixture . Configuration . GetSection ( Constants . METRIC_SETTINGS ) . Get < MetricSettings > ( ) ! )
132+ poem . FileContent ( - 1 , _metricSettings )
126133 . ShouldContain ( "locations = [\" Ici\" , \" Là\" , \" ailleurs\" ]" ) ;
127134 }
128135}
0 commit comments