public void MiddleWayTest()
        {
            //middleWay([1, 2, 3], [4, 5, 6]) → [2, 5]
            //middleWay([7, 7, 7], [3, 8, 0]) → [7, 8]
            //middleWay([5, 2, 9], [1, 4, 5]) → [2, 4]

            // Arrange
            LoopsAndArrayExercises loopsAndArrayExercises = new LoopsAndArrayExercises();

            int[] a = { 1, 2, 3 };
            int[] b = { 4, 5, 6 };

            // Act
            int[] result = loopsAndArrayExercises.MiddleWay(a, b);

            // Assert
            var expected = new int[] { 2, 5 };

            CollectionAssert.AreEqual(expected, result);

            // Arrange
            int[] c = { 7, 7, 7 };
            int[] d = { 3, 8, 0 };

            // Act
            result = loopsAndArrayExercises.MiddleWay(c, d);

            // Assert
            expected = new int[] { 7, 8 };
            CollectionAssert.AreEqual(expected, result);
        }
예제 #2
0
        public void MiddleWayTest()
        {
            LoopsAndArrayExercises myExercises = new LoopsAndArrayExercises();

            int[] a = { 1, 2, 3 };
            int[] b = { 4, 5, 6 };
            int[] c = { 2, 5 };
            CollectionAssert.AreEquivalent(c, myExercises.MiddleWay(a, b));
            CollectionAssert.AreEqual(new int[] { 2, 5 },
                                      myExercises.MiddleWay(new int[] { 1, 2, 3 }, new int[] { 4, 5, 6 }));
        }
        public void MiddleWayTest()
        {
            LoopsAndArrayExercises testClass = new LoopsAndArrayExercises();

            int[] result = testClass.MiddleWay(new int[] { 1, 2, 3 }, new int[] { 4, 5, 6 });
            CollectionAssert.AreEqual(new int[] { 2, 5 }, result);
        }
        public void MiddleWayTest()
        {
            // Arrange
            var expected = new int[] { 2, 3 };

            // Act
            var actual = _exercises.MiddleWay(new int[] { 1, 2, 6 }, new int[] { 1, 3, 6 });

            // Assert
            CollectionAssert.AreEqual(expected, actual, "Test 1: Input was [1, 2, 6] and [1, 3, 6]");

            expected = new int[] { 7, 8 };
            actual   = _exercises.MiddleWay(new int[] { 7, 7, 7 }, new int[] { 3, 8, 0 });
            CollectionAssert.AreEqual(expected, actual, "Test 1: Input was [7, 7, 7] and [3, 8, 0]");

            CollectionAssert.AreEqual(new int[] { 2, 4 },
                                      _exercises.MiddleWay(new int[] { 5, 2, 9 }, new int[] { 1, 4, 5 }),
                                      "Test 1: Input was [5, 2, 9] and [1, 4, 5]");
        }
        public void TestMiddleWay()
        {
            //middleWay([1, 2, 3], [4, 5, 6]) → [2, 5]
            int[] param1 = { 1, 2, 3 };
            int[] param2 = { 4, 5, 6 };
            int[] actual = loopClass.MiddleWay(param1, param2);

            int[] expected = { 2, 5 };

            CollectionAssert.AreEqual(expected, actual, "youre sooo close, keep going");
        }
예제 #6
0
        public void MiddleWayTest()
        {
            LoopsAndArrayExercises MiddleWayTest = new LoopsAndArrayExercises();

            int[] array1   = { 1, 2, 3 };
            int[] array2   = { 4, 5, 6 };
            int[] expected = { 2, 5 };

            int[] result = MiddleWayTest.MiddleWay(array1, array2);

            CollectionAssert.AreEqual(expected, result);
        }
        public void MiddleWayTests(int[] arrA, int[] arrB, int[] expectedResult)
        {
            // Arrange
            LoopsAndArrayExercises ex = new LoopsAndArrayExercises();


            // Act
            int[] actualResult = ex.MiddleWay(arrA, arrB);

            // Assert
            CollectionAssert.AreEquivalent(expectedResult, actualResult);
        }
예제 #8
0
        public void MiddleWayDataTest(int[] a, int[] b, int[] expectedResult)
        {
            // Arrange
            LoopsAndArrayExercises ex = new LoopsAndArrayExercises();

            // Act
            int[] actualResult = ex.MiddleWay(a, b);

            // Assert
            Assert.AreEqual(2, actualResult.Length);

            CollectionAssert.AreEqual(expectedResult, actualResult);
        }
예제 #9
0
        public void MiddleWayTest()
        {
            // Arrange
            LoopsAndArrayExercises ex = new LoopsAndArrayExercises();

            // Act
            int[] actualResult = ex.MiddleWay(new int[] { 1, 2, 3 }, new int[] { 4, 5, 6 });

            // Assert
            Assert.AreEqual(2, actualResult.Length);

            CollectionAssert.AreEqual(new int[] { 2, 5 }, actualResult);
        }
        public void TestMiddleWay()
        {
            int[] a      = { 1, 2, 3 };
            int[] b      = { 4, 5, 6 };
            int[] result = LoopsAndArrayExercises.MiddleWay(a, b);
            //int[] result = LoopsAndArrayExercises.MiddleWay(new int[] { 1, 2, 3 }, new int[] { 4, 5, 6 });
            int[] expected = { 2, 5 };

            CollectionAssert.AreEqual(expected, result);

            int[] result2 = LoopsAndArrayExercises.MiddleWay(new int[] { 5, 8, 10 }, new int[] { 24, 24, 24 });

            CollectionAssert.AreEqual(new int[] { 8, 24 }, result2);
        }
예제 #11
0
        public void MiddleWayTestHappyPath()
        {
            //middleWay([1, 2, 3], [4, 5, 6]) → [2, 5]
            //middleWay([7, 7, 7], [3, 8, 0]) → [7, 8]
            //middleWay([5, 2, 9], [1, 4, 5]) → [2, 4]

            // Arrange
            LoopsAndArrayExercises loopsAndArrayExercises = new LoopsAndArrayExercises();

            int[] first    = { 1, 2, 3 };
            int[] second   = { 4, 5, 6 };
            int[] expected = { 2, 5 };

            // Act
            int[] result = loopsAndArrayExercises.MiddleWay(first, second);

            // Assert
            CollectionAssert.AreEqual(expected, result);
        }
예제 #12
0
        public void TestMiddleWay()
        {
            //middleWay([1, 2, 3], [4, 5, 6]) → [2, 5]
            //middleWay([7, 7, 7], [3, 8, 0]) → [7, 8]
            //middleWay([5, 2, 9], [1, 4, 5]) → [2, 4]

            LoopsAndArrayExercises lae = new LoopsAndArrayExercises();

            int[] array1   = { 1, 2, 3 };
            int[] array2   = { 4, 5, 6 };
            int[] expected = { 2, 5 };

            int[] result = lae.MiddleWay(array1, array2);

            //AreEqual tests for same element in same order
            CollectionAssert.AreEqual(expected, result);

            //AreEquivalent tests for same elements in any order
            //{1,2,3} and {3,2,1} are equivalent but not equal
        }