public void SortIntArray_WithSameElement_QuickSort() { int[] source = new int[] { 999, -999, -999, 999, -999, 999, -1, 1000 }; int[] result = new int[] { -999, -999, -999, -1, 999, 999, 999, 1000 }; ArraySorter.SortIntArray(source, "Quick"); Assert.AreEqual(source, result); }
public void SortIntArray_WithNormalArray_MergeSort() { int[] source = new int[] { 999, 101010, -1, 6, 6734, 5, 3, 90, 101 }; int[] result = new int[] { -1, 3, 5, 6, 90, 101, 999, 6734, 101010 }; ArraySorter.SortIntArray(source, "Merge"); Assert.AreEqual(source, result); }
public void SortIntArray_WithWrongString_ThrowArgumentException() => Assert.Throws <ArgumentException>(() => ArraySorter.SortIntArray(new int[1], "wrong"));
public void SortIntArray_WithEmptyArray_ThrowArgumentException() => Assert.Throws <ArgumentException>(() => ArraySorter.SortIntArray(Array.Empty <int>(), ""));
public void SortIntArray_WithNullString_ThrowArgumentNullException() => Assert.Throws <ArgumentNullException>(() => ArraySorter.SortIntArray(new int[3], null));
public void SortIntArray_WithNullArray_ThrowArgumentNullException() => Assert.Throws <ArgumentNullException>(() => ArraySorter.SortIntArray(null, "Quick"));