예제 #1
0
        public void ArrayLength1_ExpectTrue()
        {
            //Arrange
            SameFirstLast exercises = new SameFirstLast();

            //Assert
            Assert.AreEqual(true, exercises.IsItTheSame(new int[] { 1 }));
        }
        public void IsItTheSame()
        {
            SameFirstLast mySameFirstLast = new SameFirstLast();

            Assert.AreEqual(false, mySameFirstLast.IsItTheSame(new int[] { 1, 2, 3 }));
            Assert.AreEqual(true, mySameFirstLast.IsItTheSame(new int[] { 1, 2, 3, 1 }));
            Assert.AreEqual(true, mySameFirstLast.IsItTheSame(new int[] { 1, 2, 1 }));
        }
        public void firstLastTest()
        {
            SameFirstLast firstLastTest = new SameFirstLast();

            Assert.AreEqual(true, firstLastTest.IsItTheSame(new int[] { 4, 8, 4 }));
            Assert.AreEqual(true, firstLastTest.IsItTheSame(new int[] { 1, 2, 3, 4, 1 }));
            Assert.AreEqual(false, firstLastTest.IsItTheSame(new int[] { 1, 2, 3, 4 }));
        }
예제 #4
0
        public void SameFirstLast()
        {
            SameFirstLast testFirstLast = new SameFirstLast();

            Assert.AreEqual(false, testFirstLast.IsItTheSame(new int[] { 1, 2, 3 }), "Test 1: Input was [1, 2, 3]");
            Assert.AreEqual(true, testFirstLast.IsItTheSame(new int[] { 1, 2, 3, 1 }), "Test 2: Input was [1, 2, 3, 1]");
            Assert.AreEqual(true, testFirstLast.IsItTheSame(new int[] { 1, 2, 1 }), "Test 3: Input was [1, 2, 1]");
        }
예제 #5
0
        public void ArrayLength0_ExpectFalse()
        {
            //Arrange
            SameFirstLast exercises = new SameFirstLast();

            //Assert
            Assert.AreEqual(false, exercises.IsItTheSame(new int[] { }));
        }
예제 #6
0
        public void IsItTheSame(int[] nums, bool expected)
        {
            SameFirstLast ex = new SameFirstLast();

            bool actualResult = ex.IsItTheSame(nums);

            Assert.AreEqual(expected, actualResult);
        }
예제 #7
0
        public void SameFirstLastTest()
        {
            SameFirstLast newStr = new SameFirstLast();

            Assert.AreEqual(true, newStr.IsItTheSame(new int[] { 1, 2, 3, 1 }));
            Assert.AreEqual(false, newStr.IsItTheSame(new int[] { 2, 4, 3, 1 }));
            Assert.AreEqual(true, newStr.IsItTheSame(new int[] { 5, 3, 2, 5 }));
        }
예제 #8
0
        public void TestSameFirstLastGivenNulls()
        {
            SameFirstLast empty = new SameFirstLast();

            int[] emptyArray = null;

            Assert.IsFalse(empty.IsItTheSame(emptyArray));
        }
예제 #9
0
        public void TwoPlusFrontAndBack()
        {
            SameFirstLast exercises = new SameFirstLast();

            Assert.AreEqual(true, exercises.IsItTheSame(new int[] { 1, 1 }));
            Assert.AreEqual(false, exercises.IsItTheSame(new int[] { 1, 3 }));
            Assert.AreEqual(false, exercises.IsItTheSame(new int[] { 1, 3, 3 }));
            Assert.AreEqual(true, exercises.IsItTheSame(new int[] { 1, 3, 1 }));
        }
        public void IsItTheSame_1231_True()
        {
            SameFirstLast sameFirstLast = new SameFirstLast();

            int[] input  = { 1, 2, 3, 1 };
            bool  result = sameFirstLast.IsItTheSame(input);

            Assert.AreEqual(true, result);
        }
예제 #11
0
        public void ItIsTheSameTestTrue121()
        {
            SameFirstLast sameFirstLast = new SameFirstLast();

            int[] parameter = { 1, 2, 1 };
            bool  value     = sameFirstLast.IsItTheSame(parameter);

            Assert.AreEqual(true, value);
        }
예제 #12
0
        public void ItIsTheSameTest()
        {
            SameFirstLast sameFirstLast = new SameFirstLast();

            int[] input  = { 1, 2, 3 };
            bool  result = sameFirstLast.IsItTheSame(input);

            Assert.AreEqual(false, input);
        }
        public void SameFirstLastTest3()
        {
            int[]         input         = { 1, 2, 1 };
            SameFirstLast sameFirstLast = new SameFirstLast();

            bool actual = sameFirstLast.IsItTheSame(input);

            Assert.AreEqual(true, actual);
        }
        public void IsItTheSameTestYes()
        {
            SameFirstLast myArray = new SameFirstLast();

            int[] array    = new int[] { 3, 2, 3 };
            bool  myResult = myArray.IsItTheSame(array);

            Assert.AreEqual(true, myResult);
        }
예제 #15
0
        public void SameFirstLastTests()
        {
            SameFirstLast sameFirstLastTest = new SameFirstLast();

            Assert.AreEqual(false, sameFirstLastTest.IsItTheSame(new int[] { 1, 2, 3 }));
            Assert.AreEqual(true, sameFirstLastTest.IsItTheSame(new int[] { 1, 2, 3, 1 }));
            Assert.AreEqual(true, sameFirstLastTest.IsItTheSame(new int[] { 1, 2, 1 }));
            Assert.AreEqual(false, sameFirstLastTest.IsItTheSame(new int[] { 1, 2 }));
            Assert.AreEqual(true, sameFirstLastTest.IsItTheSame(new int[] { 1, 1 }));
        }
예제 #16
0
    public void IsItTheSame()
        {
            int[] miaw = { 1, 2, 3 };
            int[] miaw2 = { 1, 2, 3, 1 };
            int[] miaw3 = { 1, 2, 1 };

            SameFirstLast lae = new SameFirstLast();
            Assert.IsFalse(lae.IsItTheSame(miaw));
            Assert.IsTrue(lae.IsItTheSame(miaw2));
            Assert.IsTrue(lae.IsItTheSame(miaw3));
        }
예제 #17
0
        public void IsItTheSame()
        {
            // Arrange
            SameFirstLast ex = new SameFirstLast();

            // Act
            bool actualResult = ex.IsItTheSame(new int[] { 1, 2, 3 });

            // Assert
            Assert.AreEqual(false, actualResult);
        }
예제 #18
0
        public void DataTestSameFirstLast(int[] input1, bool expectedResult)
        {
            // Arrange
            SameFirstLast ex = new SameFirstLast();

            // Act
            bool actualResult = ex.IsItTheSame(input1);

            //Assert
            Assert.AreEqual(expectedResult, actualResult);
        }
예제 #19
0
        public void GetHerdTest()
        {
            var exercise = new SameFirstLast();

            //IsItTheSame([1, 2, 3]) → false
            Assert.AreEqual(false, exercise.IsItTheSame(new int[] { 1, 2, 3 }));
            //IsItTheSame([1, 2, 3, 1]) → true
            Assert.AreEqual(true, exercise.IsItTheSame(new int[] { 1, 2, 3, 1 }));
            //IsItTheSame([1, 2, 1]) → true
            Assert.AreEqual(true, exercise.IsItTheSame(new int[] { 1, 2, 1 }));
        }
예제 #20
0
        public void ArrayLength2OrMore()
        {
            //Arrange
            SameFirstLast exercises = new SameFirstLast();

            //Assert
            Assert.AreEqual(true, exercises.IsItTheSame(new int[] { 1, 1 }));
            Assert.AreEqual(true, exercises.IsItTheSame(new int[] { 1, 3, 1 }));
            Assert.AreEqual(false, exercises.IsItTheSame(new int[] { 1, 3 }));
            Assert.AreEqual(false, exercises.IsItTheSame(new int[] { 1, 3, 3 }));
        }
예제 #21
0
        public void TestSameFirstLastHappyPath()
        {
            SameFirstLast happyPath = new SameFirstLast();
            List <int[]>  numArrays = new List <int[]>
            {
                new int[] { 1, 2, 3, 1 },
                new int[] { 2, 3, 1, 2 }
            };

            Assert.IsTrue(happyPath.IsItTheSame(numArrays[0]));
            Assert.IsTrue(happyPath.IsItTheSame(numArrays[1]));
        }
예제 #22
0
        public void theSameTests()
        {
            //Arrange
            SameFirstLast testIsItTheSame = new SameFirstLast();

            //Act

            //Assert
            Assert.AreEqual(true, testIsItTheSame.IsItTheSame(new int[] { 1, 2, 3, 1 }));

            Assert.AreEqual(true, testIsItTheSame.IsItTheSame(new int[] { 1, 2, 1 }));
        }
        public void AreFirstAndLastIndexEqualLength1()
        {
            //Arrange
            SameFirstLast intArray = new SameFirstLast();

            int[] numbers = { 3 };
            //Act
            bool result = intArray.IsItTheSame(numbers);

            //Assert
            Assert.AreEqual(false, result);
        }
        public void False_If_First_And_Last_Are_Different()
        {
            //Arrange
            SameFirstLast testMethod = new SameFirstLast();

            int[] testArray      = new int[] { 1, 1, 3, 5, 511, 99 };
            bool  expectedResult = false;
            //Act
            bool actualResult = testMethod.IsItTheSame(testArray);

            //Assert
            Assert.AreEqual(expectedResult, actualResult);
        }
        public void ShouldReturnTrueWithLengthOfOne()
        {
            //arrange
            SameFirstLast newSameFirstLast = new SameFirstLast();

            int[] numbers = { 13 };

            //act
            bool oneOrMoreAndTheSame = newSameFirstLast.IsItTheSame(numbers);

            //assert
            Assert.AreEqual(true, oneOrMoreAndTheSame);
        }
        public void ShouldReturnFalseWithLengthUnderOne()
        {
            //arrange
            SameFirstLast newSameFirstLast = new SameFirstLast();

            int[] numbers = { };

            //act
            bool oneOrMoreAndTheSame = newSameFirstLast.IsItTheSame(numbers);

            //assert
            Assert.AreEqual(false, oneOrMoreAndTheSame);
        }
예제 #27
0
        public void IsItTheSameVariables()
        {
            int[] miaw = { 0, 1, 0 };
            int[] miaw2 = { -5, 0, -89, -5 };
            int[] miaw3 = {1};
            int[] miaw4 = { };

            SameFirstLast lae = new SameFirstLast();
            Assert.IsTrue(lae.IsItTheSame(miaw));
            Assert.IsTrue(lae.IsItTheSame(miaw2));
            Assert.IsTrue(lae.IsItTheSame(miaw3));
            Assert.IsFalse(lae.IsItTheSame(miaw4));
        }
예제 #28
0
        public void notTheSameTests()
        {
            //Arrange
            SameFirstLast testIsItTheSame  = new SameFirstLast();
            SameFirstLast testIsIt2TheSame = new SameFirstLast();
            SameFirstLast testIsIt3TheSame = new SameFirstLast();
            //Act
            bool testIsNotSame  = testIsItTheSame.IsItTheSame(new int[] { 32, 13, 30 });
            bool testIsNotSame2 = testIsIt2TheSame.IsItTheSame(new int[] { 1, 2, 3 });

            bool testIsNotSame3 = testIsIt3TheSame.IsItTheSame(new int[] { 1, 2, 3, 1, 5 });

            //Assert
            Assert.AreEqual(false, testIsNotSame);
            Assert.AreEqual(false, testIsNotSame2);
            Assert.AreEqual(false, testIsNotSame3);
        }
        public void SameFirstLast()
        {
            SameFirstLast _exercises = new SameFirstLast();

            int[] a      = new int[] { 1, 2, 3 };
            bool  result = _exercises.IsItTheSame(a);

            Assert.AreEqual(false, result, "Input: int[] a = {1, 2, 3})");

            int[] b = new int[] { 1, 2, 3, 1 };
            result = _exercises.IsItTheSame(b);
            Assert.AreEqual(true, result, "Input: int[] b = {1, 2, 3, 1})");

            int[] c = new int[] { 1, 2, 1 };
            result = _exercises.IsItTheSame(c);
            Assert.AreEqual(true, result, "Input: int[] c = {1, 2, 1})");
        }
예제 #30
0
        public void ArrayLength()
        {
            SameFirstLast arrayLength = new SameFirstLast();
            bool          result      = arrayLength.IsItTheSame(new int[] { 1, 2, 3 });

            Assert.AreEqual(false, result);

            SameFirstLast arrayLengthEqual = new SameFirstLast();
            bool          result2          = arrayLength.IsItTheSame(new int[] { 1, 2, 3, 1 });

            Assert.AreEqual(true, result2);

            SameFirstLast arrayLengthEqualShort = new SameFirstLast();
            bool          result3 = arrayLength.IsItTheSame(new int[] { 1, 2, 1 });

            Assert.AreEqual(true, result3);
        }