Exemplo n.º 1
0
        public void SimpleMixer_Can_Iterate_More_52_items()
        {
            var simpleMixer = new SimpleMixer <string>(1);
            var baseArray   = new List <string>()
            {
                "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"
            };

            var list100Items  = baseArray.SelectMany(x => baseArray.Select(y => string.Concat(x + "." + y))).ToList();
            var shuffledArray = simpleMixer.Shuffle(list100Items).ToList();

            Assert.AreEqual(100, list100Items.Count());
            Assert.AreEqual(list100Items.Count(), shuffledArray.Count());
        }
Exemplo n.º 2
0
        public void SimpleMixer_1_Round_Of_Shuffle()
        {
            var simpleMixer   = new SimpleMixer <string>(1);
            var originalArray = new List <string>()
            {
                "a", "b", "c", "d", "e"
            };
            var shuffledArray = simpleMixer.Shuffle(originalArray).ToList();

            Assert.AreEqual(originalArray.Count(), shuffledArray.Count());
            Assert.AreEqual(0, originalArray.Except(shuffledArray).Count());
            Assert.AreEqual(originalArray.Distinct().Count(), shuffledArray.Distinct().Count());
            Assert.AreEqual(5, originalArray.Intersect(shuffledArray).Count());
        }