public void TestNullArray() { BubbleSort.Program p = new BubbleSort.Program(); int[] actual = p.BubbleSortMethod(null); //int[] expected = new int[] { }; Assert.Throws <NullReferenceException>(() => actual); }
public void TestArrayOfLengthOneArraySort() { BubbleSort.Program p = new BubbleSort.Program(); int[] testArr = new int[] { 3 }; int[] actual = p.BubbleSortMethod(testArr); int[] expected = testArr; Assert.Equal(expected, actual); }
public void TestBackwardsSortedArraySort() { BubbleSort.Program p = new BubbleSort.Program(); int[] testArr = new int[] { 8, 5, 4, 2, 1 }; int[] actual = p.BubbleSortMethod(testArr); int[] expected = new int[] { 1, 2, 4, 5, 8 }; Assert.Equal(expected, actual); }
public void TestAlreadySortedArraySort() { BubbleSort.Program p = new BubbleSort.Program(); int[] testArr = new int[] { 1, 2, 4, 5, 8 }; int[] actual = p.BubbleSortMethod(testArr); int[] expected = testArr; Assert.Equal(expected, actual); }
public void TestEmptyArraySort() { BubbleSort.Program p = new BubbleSort.Program(); int[] emptyArray = new int[] { }; int[] actual = p.BubbleSortMethod(emptyArray); int[] expected = new int[] { }; Assert.Equal(expected, actual); }
public void TestNegativeIntInArrayForSort() { BubbleSort.Program p = new BubbleSort.Program(); int[] testArr = new int[] { 5, -1, 2, 8, 4 }; int[] actual = p.BubbleSortMethod(testArr); int[] expected = new int[] { -1, 2, 4, 5, 8 }; Assert.Equal(expected, actual); }
public void TestEvenLengthArrayForSort() { BubbleSort.Program p = new BubbleSort.Program(); int[] testArr = new int[] { 5, 1, 2, 8, 4, 7 }; int[] actual = p.BubbleSortMethod(testArr); int[] expected = new int[] { 1, 2, 4, 5, 7, 8 }; Assert.Equal(expected, actual); }