Пример #1
0
        public void Test_IsPalindrome()
        {
            var exercise05 = new Exercise05();

            Assert.AreEqual(exercise05.IsPalindrome("abcdcba"), true);
            Assert.AreEqual(exercise05.IsPalindrome("abcd"), false);
        }
Пример #2
0
 public void ShouldReturnTrueForValuesNearMultiplesOfOneHundred()
 {
     Assert.That(!Exercise05.IsWithinFiveOfAHundred(-106));
     Assert.That(!Exercise05.IsWithinFiveOfAHundred(37));
     Assert.That(!Exercise05.IsWithinFiveOfAHundred(-94));
     Assert.That(Exercise05.IsWithinFiveOfAHundred(-105));
     Assert.That(Exercise05.IsWithinFiveOfAHundred(95));
 }
Пример #3
0
 public void TestIncorrectPowers()
 {
     for (int i = 1; i < 30; i++)
     {
         var actualResult = Exercise05.Run((int)Math.Pow(2, i) + 1);
         Assert.IsFalse(actualResult);
     }
 }
Пример #4
0
 public void TestIncorrectPowers()
 {
     for (var i = 1; i < 30; i++)
     {
         var actualResult = Exercise05.Run((int)Math.Pow(2, i) + 1);
         actualResult.Should().BeFalse();
     }
 }
Пример #5
0
        public void Test_ArmstrongNumbers()
        {
            var exercise05 = new Exercise05();

            Assert.AreEqual(exercise05.ArmstrongNumbers(3), "153 370 371 407");
            Assert.AreEqual(exercise05.ArmstrongNumbers(4), "1634 8208 9474");
            Assert.AreEqual(exercise05.ArmstrongNumbers(5), "54748 92727 93084");
        }
Пример #6
0
 public void Test_TimSo_Ok(string result)
 {
     Assert.AreEqual(Exercise05.FindNumber(), result);
 }
Пример #7
0
        public void TestZeroNumber()
        {
            var actualResult = Exercise05.Run(0);

            actualResult.Should().BeFalse();
        }
Пример #8
0
        public void TestNegativeNumber()
        {
            var actualResult = Exercise05.Run(-2);

            actualResult.Should().BeFalse();
        }
Пример #9
0
        public void Exercise05_Test(int resultExpected, string text)
        {
            var result = Exercise05.DistinctCharacters(text);

            Assert.Equal(resultExpected, result);
        }
Пример #10
0
        public void TestZeroNumber()
        {
            var actualResult = Exercise05.Run(0);

            Assert.IsFalse(actualResult);
        }
Пример #11
0
        public void TestNegativeNumber()
        {
            var actualResult = Exercise05.Run(-2);

            Assert.IsFalse(actualResult);
        }
Пример #12
0
        public void Test_LongestIncreasingSubArray()
        {
            var exercise05 = new Exercise05();

            Assert.AreEqual(exercise05.LongestIncreasingSubArray(new int[] { 5, 6, 3, 5, 7, 8, 9, 1, 2 }), "3 5 7 8 9");
        }