public void MergeSortingTest2() { // Arrange int[] unsorted = { 1 }; // Act int[] sortedByMergeSort = SortingClass.MergeSorting(unsorted); // Assert CollectionAssert.AreEqual(new int[] { 1 }, sortedByMergeSort); }
public void MergeSortingTest1() { // Arrange int[] unsorted = { 1, -5, 0, 15, -4, 27 }; // Act int[] sortedByMergeSort = SortingClass.MergeSorting(unsorted); // Assert CollectionAssert.AreEqual(new int[] { -5, -4, 0, 1, 15, 27 }, sortedByMergeSort); }
public void MergeSortingTest3() { // Arrange int[] unsorted = new int[100]; Random random = new Random(); for (int i = 0; i < unsorted.Length; ++i) { unsorted[i] = random.Next(int.MinValue, int.MaxValue); } // Act int[] sortedByMergeSort = SortingClass.MergeSorting(unsorted); // Assert Assert.IsTrue(IsArraySorted(sortedByMergeSort)); }
public void MergeSortingTest_AcceptsEmptyArray_ThrowsArgumentException() { int[] unsorted = new int[0]; Assert.ThrowsException <ArgumentException>(() => SortingClass.MergeSorting(unsorted)); }
public void MergeSortingTest_AcceptsNullArray_ThrowsNullReferenceException() { int[] unsorted = null; Assert.ThrowsException <NullReferenceException>(() => SortingClass.MergeSorting(unsorted)); }