@@ -14,6 +14,7 @@ public class IntListRandomizerTests : IClassFixture<IntListTestFixture>
1414 {
1515 IntListTestFixture _testData ;
1616
17+
1718 public IntListRandomizerTests ( IntListTestFixture testData )
1819 {
1920 _testData = testData ;
@@ -25,14 +26,10 @@ public IntListRandomizerTests(IntListTestFixture testData)
2526 [ Fact ]
2627 public void random_element_from_int_list ( )
2728 {
28- // Get random elements from ~1/10 of the list. The probability of sequential duplicates
29- // increases when covering more of the available elements.
30- int prev = - 1 ;
31- for ( int i = 0 ; i < _testData . TestList . Count / 10 ; ++ i )
29+ for ( int i = 0 ; i < _testData . TestList . Count ; ++ i )
3230 {
3331 int curr = _testData . TestList . Random ( ) ;
34- curr . Should ( ) . NotBe ( prev ) ;
35- prev = curr ;
32+ curr . Should ( ) . BeGreaterOrEqualTo ( IntListTestFixture . MinTestValue ) ;
3633 }
3734 }
3835
@@ -44,7 +41,7 @@ public void random_element_from_int_list_by_IEnumerable()
4441 foreach ( var itr in enumr )
4542 {
4643 int curr = enumr . Random ( ) ;
47- curr . Should ( ) . BeGreaterThan ( - 1 ) ;
44+ curr . Should ( ) . BeGreaterOrEqualTo ( IntListTestFixture . MinTestValue ) ;
4845 }
4946 }
5047
@@ -73,12 +70,11 @@ public void random_element_from_()
7370
7471 // Get random elements from ~1/10 of the list. The probability of sequential duplicates
7572 // increases when covering more of the available elements.
76- KeyValuePair < int , string > prev = new KeyValuePair < int , string > ( ) ;
77- for ( int i = 0 ; i < list . Count / 10 ; ++ i )
73+ for ( int i = 0 ; i < list . Count ; ++ i )
7874 {
7975 var curr = list . Random ( ) ;
80- curr . Should ( ) . NotBe ( prev ) ;
81- prev = curr ;
76+ curr . Key . Should ( ) . BeGreaterOrEqualTo ( IntListTestFixture . MinTestValue ) ;
77+ curr . Value . Should ( ) . BeEquivalentTo ( curr . Key . ToString ( ) ) ;
8278 }
8379 }
8480
0 commit comments