예제 #1
0
        public void SortTheOdd_HasOddAndEven(int[] input)
        {
            var expected = new[] { 1, 3, 2, 8, 5, 4 }.ToExpectedObject();
            var actual = SortTheOdd.SortArray(input);

            expected.ShouldEqual(actual);
        }
예제 #2
0
        public void SortTheOdd_HasOnlyEvenNum(int[] input)
        {
            var expected = new[] { 2, 6, 4, 8 }.ToExpectedObject();
            var actual = SortTheOdd.SortArray(input);

            expected.ShouldEqual(actual);
        }
예제 #3
0
        public void SortTheOdd_EmptyArray(int[] input)
        {
            var expected = new int[0].ToExpectedObject();
            var actual   = SortTheOdd.SortArray(input);

            expected.ShouldEqual(actual);
        }
예제 #4
0
        public void Sort_ValidInput_SortedOddsReturned()
        {
            // Arrange
            var input = new int[] { 5, 3, 2, 8, 1, 4 };
            var output = new int[] { 1, 3, 2, 8, 5, 4 };

            // Act
            var result = SortTheOdd.Sort(input);

            // Assert
            result.Should().BeEquivalentTo(output);
        }
예제 #5
0
 public void GivenEmptyArrayThenEmptyArrayReturned()
 {
     Assert.Equal(new int[] { }, SortTheOdd.SortArray(new int[] { }));
 }
예제 #6
0
 public void GivenArrayWithOddsAndEvensThenOddsSortedArrayReturned()
 {
     Assert.Equal(new int[] { 3, 20, 7, 9, 8, 15 }, SortTheOdd.SortArray(new int[] { 7, 20, 3, 15, 8, 9 }));
 }
예제 #7
0
 public void GivenOnlyOddsArrayThenSortedArrayReturned()
 {
     Assert.Equal(new int[] { 3, 7, 9, 15 }, SortTheOdd.SortArray(new int[] { 7, 3, 15, 9 }));
 }
예제 #8
0
 public void GivenOnlyEvensArrayThenSameArrayReturned()
 {
     Assert.Equal(new int[] { 2, 8, 6, 10 }, SortTheOdd.SortArray(new int[] { 2, 8, 6, 10 }));
 }
예제 #9
0
 public void BasicTests()
 {
     Assert.AreEqual(new int[] { 1, 3, 2, 8, 5, 4 }, SortTheOdd.SortArray(new int[] { 5, 3, 2, 8, 1, 4 }));
     Assert.AreEqual(new int[] { 1, 3, 5, 8, 0 }, SortTheOdd.SortArray(new int[] { 5, 3, 1, 8, 0 }));
     Assert.AreEqual(new int[] { }, SortTheOdd.SortArray(new int[] { }));
 }
예제 #10
0
 public void Test_Sort1()
 {
     Assert.Equal(new int[] { 1, 3, 2, 8, 5, 4 }, SortTheOdd.Sort(new int[] { 5, 3, 2, 8, 1, 4 }));
     Assert.Equal(new int[] { 1, 3, 5, 8, 0 }, SortTheOdd.Sort(new int[] { 5, 3, 1, 8, 0 }));
     Assert.Equal(new int[] { }, SortTheOdd.Sort(new int[] { }));
 }