public void WhenCalledMultipleTimesItemsAreRandom() { var itemList = new List <int>() { 1, 2, 3 }; var random = new Mock <Random>(); random.SetupSequence(r => r.Next(It.IsAny <int>())).Returns(0).Returns(2).Returns(1); var selector = new RandomSelector <int>(random.Object, itemList); var first = selector.GetNext(); var second = selector.GetNext(); var third = selector.GetNext(); Assert.AreEqual(first, itemList[0]); Assert.AreEqual(second, itemList[2]); Assert.AreEqual(third, itemList[1]); }
public void AnItemIsReturned() { var itemList = new List <int>() { 1, 2, 3 }; var selector = new RandomSelector <int>(new Random(), itemList); var next = selector.GetNext(); Assert.True(itemList.Contains(next)); }