public void Sort_EmptyArray_Success() { var sorter = new MergeSorter <int>(); var array = new int[0]; sorter.Sort(array); Assert.IsTrue(sorter.Ensure(array)); }
public void Sort_SingleElementArray_Success() { var sorter = new MergeSorter <int>(); var array = new int[1] { 0 }; sorter.Sort(array); Assert.IsTrue(sorter.Ensure(array)); }
public void Sort_ValidArray_Success() { var sorter = new MergeSorter <int>(); var array = new int[10] { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; sorter.Sort(array); Assert.IsTrue(sorter.Ensure(array)); }
public void DivideAndRule_ValidArray_Success() { var sorter = new MergeSorter <int>(); var inputArray = new int[10] { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; var outputArray = new int[10] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; MethodInfo methodInfo = typeof(MergeSorter <int>).GetMethod("DivideAndRule", BindingFlags.NonPublic | BindingFlags.Instance); inputArray = (int[])methodInfo.Invoke(sorter, new object[] { inputArray }); Assert.IsTrue(sorter.Ensure(inputArray)); Assert.IsTrue(inputArray.SequenceEqual(outputArray)); }