public void SortTest() { BubbleSortV2 target = new BubbleSortV2(); List<int> list = new List<int>(); target.Init(list, 10); List<int> actual; actual = target.Sort(list); // Verify if the list is ascending for (int i = 0; i < (actual.Count - 1); i++) { Assert.IsTrue(actual[i] <= actual[i + 1]); } }
public void IntegerArray_Sort_ReturnsArrayWithSortedValues() { //Arrange var values = new int[] { 5, 4, 3, 2, 1 }; var bubbleSort = new BubbleSortV2(); var expectedValues = new int[] { 1, 2, 3, 4, 5 }; //Act var actualValues = bubbleSort.Sort(values); //Assert for (var i = 0; i < values.Length; i++) { Assert.AreEqual(expectedValues[i], actualValues[i]); } }