public void MaxEnd3Test() { // maxEnd3([1, 2, 3]) → [3, 3, 3] // maxEnd3([11, 5, 9]) → [11, 11, 11] // maxEnd3([2, 11, 3]) → [3, 3, 3] LoopsAndArrayExercises MaxEnd3Test = new LoopsAndArrayExercises(); int[] array1 = { 1, 2, 3 }; int[] expected1 = { 3, 3, 3 }; int[] array2 = { 11, 5, 9 }; int[] expected2 = { 11, 11, 11 }; int[] array3 = { 2, 11, 3 }; int[] expected3 = { 3, 3, 3 }; int[] result = MaxEnd3Test.MaxEnd3(array1); CollectionAssert.AreEqual(array1, expected1); int[] result = MaxEnd3Test.MaxEnd3(array2); CollectionAssert.AreEqual(array2, expected2); int[] result = MaxEnd3Test.MaxEnd3(array1); CollectionAssert.AreEqual(array3, expected3); }
public void MaxEnd3Test() { // Arrange int[] input1 = { 1, 2, 3 }; int[] input2 = { 11, 5, 9 }; int[] input3 = { 2, 11, 3 }; // Act int[] actual1 = _exercises.MaxEnd3(input1); int[] actual2 = _exercises.MaxEnd3(input2); int[] actual3 = _exercises.MaxEnd3(input3); // Assert int[] expected1 = { 3, 3, 3 }; int[] expected2 = { 11, 11, 11 }; int[] expected3 = { 3, 3, 3 }; CollectionAssert.AreEqual(expected1, actual1, "Test 1: Input was [1, 2, 3]"); CollectionAssert.AreEqual(expected2, actual2, "Test 2: Input was [11, 5, 9]"); CollectionAssert.AreEqual(expected3, actual3, "Test 3: Input was [2, 11, 3]"); }
public void TestMaxEnd3() { //max end 3 is not static so i have to create an object to call it LoopsAndArrayExercises lAndAExer = new LoopsAndArrayExercises(); //test last one is bigger int [] result = lAndAExer.MaxEnd3(new int[] { 1, 2, 3 }); CollectionAssert.AreEqual(new int[] { 3, 3, 3 }, result); //test 1,10,3 or middle is biggest result = lAndAExer.MaxEnd3(new int[] { 1, 10, 3 }); CollectionAssert.AreEqual(new int[] { 3, 3, 3 }, result); //test first is biggest result = lAndAExer.MaxEnd3(new int[] { 201, 10, 3 }); CollectionAssert.AreEqual(new int[] { 201, 201, 201 }, result); //test all same neg result = lAndAExer.MaxEnd3(new int[] { -1, -1, -1 }); CollectionAssert.AreEqual(new int[] { -1, -1, -1 }, result); }
public void TestMaxEnd3() { //maxEnd3([1, 2, 3]) → [3, 3, 3] //maxEnd3([11, 5, 9]) → [11, 11, 11] //maxEnd3([2, 11, 3]) → [3, 3, 3] LoopsAndArrayExercises lae = new LoopsAndArrayExercises(); int[] array = { 1, 2, 3 }; int[] result = lae.MaxEnd3(array); //int [] result = lae.MaxEnd3( new int[] {1,2,3}); anonymous array because i didn't save a reference to it CollectionAssert.AreEqual(new int[] { 3, 3, 3 }, result); result = lae.MaxEnd3(new int[] { 11, 5, 9 }); CollectionAssert.AreEqual(new int[] { 11, 11, 11 }, result); result = lae.MaxEnd3(new int[] { 2, 11, 3 }); CollectionAssert.AreEqual(new int[] { 3, 3, 3 }, result); }