示例#1
0
            public void WhenCalledMultipleTimesTheSameItemIsReturned()
            {
                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);
                var selector = new RandomSelector <int>(random.Object, itemList);

                var first  = selector.PeekNext();
                var second = selector.PeekNext();

                Assert.AreEqual(first, itemList[0]);
                Assert.AreEqual(second, first);
            }
示例#2
0
            public void AnItemIsReturned()
            {
                var itemList = new List <int>()
                {
                    1, 2, 3
                };
                var selector = new RandomSelector <int>(new Random(), itemList);

                var next = selector.PeekNext();

                Assert.True(itemList.Contains(next));
            }