Beispiel #1
0
        public void Test1()
        {
            var list = new List <int> {
                5, 8, 4, 1, 2, 6, 4, 7, 9, 2
            };

            InsertionSorter.InsertionSort <int>(list, null);
        }
Beispiel #2
0
        public void ShouldSortTwoItems()
        {
            var sorter = new InsertionSorter <int>();

            int[] items = { 8, 3 };
            sorter.InsertionSort(items);

            Assert.AreEqual(new int[] { 3, 8 }, items);
        }
Beispiel #3
0
        public void ShouldSortMultipleItems()
        {
            var sorter = new InsertionSorter <int>();

            int[] items = { 8, 3, 4, 12, 73, 1, 3, 4, 5 };
            sorter.InsertionSort(items);

            Assert.AreEqual(new int[] { 1, 3, 3, 4, 4, 5, 8, 12, 73 }, items);
        }
Beispiel #4
0
        public void ShouldSortEmptyArray()
        {
            var sorter = new InsertionSorter <int>();

            int[] items = { };
            sorter.InsertionSort(items);

            Assert.IsEmpty(items);
        }