@@ -10,23 +10,27 @@ namespace Test.AMT.LinqExtensions
1010 // TODO: include when doing code coverage
1111 // [ExcludeFromCodeCoverage]
1212
13- public class LinqRandomizerTests
13+ public class LinqRandomizerTests : IClassFixture < TestDataFixture >
1414 {
15+ TestDataFixture _testData ;
16+
17+ public LinqRandomizerTests ( TestDataFixture testData )
18+ {
19+ _testData = testData ;
20+ }
21+
1522
1623 #region Positive tests
1724
1825 [ Fact ]
1926 public void random_element_from_int_list ( )
2027 {
21- List < int > list = new List < int > ( ) ;
22- for ( int i = 0 ; i < 250 ; ++ i ) { list . Add ( i ) ; }
23-
2428 // Get random elements from ~1/10 of the list. The probability of sequential duplicates
2529 // increases when covering more of the available elements.
2630 int prev = - 1 ;
27- for ( int i = 0 ; i < list . Count / 10 ; ++ i )
31+ for ( int i = 0 ; i < _testData . TestList . Count / 10 ; ++ i )
2832 {
29- int curr = list . Random ( ) ;
33+ int curr = _testData . TestList . Random ( ) ;
3034 curr . Should ( ) . NotBe ( prev ) ;
3135 prev = curr ;
3236 }
@@ -36,10 +40,7 @@ public void random_element_from_int_list()
3640 [ Fact ]
3741 public void random_element_from_int_list_by_IEnumerable ( )
3842 {
39- List < int > list = new List < int > ( ) ;
40- for ( int i = 0 ; i < 250 ; ++ i ) { list . Add ( i ) ; }
41-
42- IEnumerable < int > enumr = list ;
43+ IEnumerable < int > enumr = _testData . TestList ;
4344 foreach ( var itr in enumr )
4445 {
4546 int curr = enumr . Random ( ) ;
@@ -67,7 +68,6 @@ public void random_element_from_single_item_list()
6768 [ Fact ]
6869 public void random_element_from_ ( )
6970 {
70-
7171 SortedList < int , string > list = new SortedList < int , string > ( ) ;
7272 for ( int i = 0 ; i < 250 ; ++ i ) { list . Add ( i , i . ToString ( ) ) ; }
7373
0 commit comments