Beispiel #1
0
 public void TestNullArray()
 {
     BubbleSort.Program p = new BubbleSort.Program();
     int[] actual         = p.BubbleSortMethod(null);
     //int[] expected = new int[] { };
     Assert.Throws <NullReferenceException>(() => actual);
 }
Beispiel #2
0
 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);
 }
Beispiel #3
0
 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);
 }
Beispiel #4
0
 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);
 }
Beispiel #5
0
 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);
 }
Beispiel #6
0
 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);
 }
Beispiel #7
0
 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);
 }