public void Test_MergeInsertionSorter_ShouldThrowExceptionWhenCollectionIsNull() { var sorter = new MergeInsertionSorter <int>(); var emptyCollection = new SortableCollection <int>(null); emptyCollection.Sort(sorter); }
public void Test_MergeInsertionSorter_ShouldSortCorrectly() { var mergeInsertionSorter = new MergeInsertionSorter<int>(); collection.Sort(mergeInsertionSorter); bool isSortedCorrectly = true; for (int i = 0; i < collection.Items.Count - 1; i++) { if (collection.Items[i].CompareTo(collection.Items[i + 1]) > 0) { isSortedCorrectly = false; break; } } Assert.IsTrue(isSortedCorrectly, "MergeInsertionSorter should sort correctly."); }
public void Test_MergeInsertionSorter_ShouldSortCorrectly() { var mergeInsertionSorter = new MergeInsertionSorter <int>(); collection.Sort(mergeInsertionSorter); bool isSortedCorrectly = true; for (int i = 0; i < collection.Items.Count - 1; i++) { if (collection.Items[i].CompareTo(collection.Items[i + 1]) > 0) { isSortedCorrectly = false; break; } } Assert.IsTrue(isSortedCorrectly, "MergeInsertionSorter should sort correctly."); }
public void Test_MergeInsertionSorter_ShouldThrowExceptionWhenCollectionIsNull() { var sorter = new MergeInsertionSorter<int>(); var emptyCollection = new SortableCollection<int>(null); emptyCollection.Sort(sorter); }