public static void ArrayShuffled_NewArrayHasSameSize( [Random(0, 1000, 100, Distinct = true)] int n) { // Arrange var shuffler = new FisherYatesShuffler <int>(); var(correctArray, testArray) = RandomHelper.GetArrays(n); // Act shuffler.Shuffle(testArray); // Assert testArray.Length.Should().Be(correctArray.Length); }
public static void ArrayShuffled_NewArrayHasSameValues( [Random(0, 1000, 100, Distinct = true)] int n) { // Arrange var shuffler = new FisherYatesShuffler <int>(); var(correctArray, testArray) = RandomHelper.GetArrays(n); // Act shuffler.Shuffle(testArray); Array.Sort(testArray); Array.Sort(correctArray); // Assert testArray.Should().BeEquivalentTo(correctArray); }
private static List <IPlayer> ShufflePlayers(List <IPlayer> players) { var shuffler = new FisherYatesShuffler(new RandomWrapper()); return(players.Shuffle(shuffler)); }
public void SetUp() { _mockRandom = Fixture.Mock <Random>(); _shuffler = Fixture.Create <FisherYatesShuffler>(); }