コード例 #1
0
        public void SelectionTest()
        {
            int[]         numbers   = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            SelectionSort selection = new SelectionSort();

            int[] i = selection.Selection();

            CollectionAssert.AreEqual(i, numbers);
        }
コード例 #2
0
        public void SelectionSortWorksCorrectly()
        {
            //Arrange
            int[] array      = new int[] { -50, 3, 3, 7, -125, 4, 0, -22, -22, -178, 99, 120, -33, 9, 5, 2, 6, 1, 1, 8, 10, 55, 110, 12, 34, 66, 66 };
            int[] otherArray = new int[] { -50, 3, 3, 7, -125, 4, 0, -22, -22, -178, 99, 120, -33, 9, 5, 2, 6, 1, 1, 8, 10, 55, 110, 12, 34, 66, 66 };
            var   sort       = new SelectionSort();

            //Act
            sort.Selection(array);
            Array.Sort(otherArray);

            //Assert
            CollectionAssert.AreEqual(otherArray, array);
        }