Beispiel #1
0
        public void SortTest()
        {
            // Arrange
            var coctail = new CoctailSort <int>();

            var rnd   = new Random();
            var items = new List <int>();

            for (var i = 0; i < 10000; i++)
            {
                items.Add(rnd.Next(0, 100));
            }

            coctail.Items.AddRange(items);
            var sorted = items.OrderBy(x => x).ToArray();

            // Act
            coctail.Sort();


            // Assert
            for (var i = 0; i < items.Count; i++)
            {
                Assert.AreEqual(sorted[i], coctail.Items[i]);
            }
        }
Beispiel #2
0
        public void CoctailSortTest()
        {
            var coctail = new CoctailSort <int>();

            coctail.Items.AddRange(items);
            coctail.Sort();
            for (int i = 0; i < items.Count; i++)
            {
                Assert.AreEqual(sorted[i], coctail.Items[i]);
            }
        }
Beispiel #3
0
        public void CocktailSortTest()
        {
            int[] result = CreateResultArray();

            CoctailSort <int> sort = new CoctailSort <int>(result);

            result = sort.Sort();

            for (int i = 0; i < array.Length; i++)
            {
                Assert.AreEqual(expected[i], result[i]);
            }
        }
Beispiel #4
0
        public void CoctailSortTest()
        {
            // Arrange
            var coctail = new CoctailSort <int>();

            coctail.Items.AddRange(Items);

            // Act
            coctail.Sort();

            // Assest
            for (int i = 0; i < Items.Count; i++)
            {
                Assert.AreEqual(Sorted[i], coctail.Items[i]);
            }
        }
Beispiel #5
0
        public void SortTest()
        {
            //arrange
            var rnd        = new Random();
            var collection = new List <int>();
            var coctail    = new CoctailSort <int>();

            for (int i = 0; i < 10; i++)
            {
                collection.Add(rnd.Next(0, 100));
            }
            coctail.Items.AddRange(collection);
            collection.Sort();

            //act
            coctail.Sort();

            //arrange

            for (int i = 0; i < 10; i++)
            {
                Assert.AreEqual(collection[i], coctail.Items[i]);
            }
        }