Beispiel #1
0
        public void InputStringIsGreaterThan100_ThrowException()
        {
            var input = new string(Enumerable.Repeat('a', 101)
                                   .Select(s => s).ToArray());

            Assert.Throws <InvalidOperationException>(() => RepeatedString.GetTotal(input, 1));
        }
Beispiel #2
0
        public void Test1()
        {
            long   n        = 10;
            string s        = "aba";
            long   expected = 7;
            long   result   = RepeatedString.Solution(s, n);

            Assert.Equal(expected, result);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            var C = new RepeatedString();
            var t = C.CountString("aba", 20);

            Console.WriteLine(t);


            Console.ReadKey();
        }
Beispiel #4
0
        public void TestCase1()
        {
            //Arrange
            long   numberOfChars = 1000000000000;
            string s             = "a";
            //Act
            var result = RepeatedString.repeatedString(s, numberOfChars);

            //Assert
            Assert.AreEqual(1000000000000, result);
        }
        public void RepeatedStringTestCase3()
        {
            string inputString = "abcac";

            long repeatCount = 10;

            long expectedOutput = 4;

            long actualOutput = RepeatedString.Solve(inputString, repeatCount);

            Assert.AreEqual(expectedOutput, actualOutput);
        }
        public void Run()
        {
            PrintProblem();

            Console.WriteLine("s:");
            s = Console.ReadLine();
            Console.WriteLine("n:");
            n = Convert.ToInt64(Console.ReadLine());

            long result = RepeatedString.repeatedString(s, n);

            Console.WriteLine();
            Console.WriteLine("Result:");
            Console.WriteLine(result);
            Console.ReadKey();
        }
Beispiel #7
0
 public void RepeatedStringTest(string s, long n, long expected)
 {
     Assert.Equal(expected, RepeatedString.Execute(s, n));
 }
Beispiel #8
0
        public void ShouldReturnExpectedResult(string input, long repeat, long expectedResult)
        {
            var result = RepeatedString.GetTotal(input, repeat);

            Assert.AreEqual(expectedResult, result);
        }
Beispiel #9
0
        public void InputNumberIsGreaterthan10PowerOf12_ThrowException()
        {
            long input = (long)Math.Pow(10, 12) + 1;

            Assert.Throws <InvalidOperationException>(() => RepeatedString.GetTotal("a", input));
        }
Beispiel #10
0
        public void InputNumberIsLessthan1_ThrowException()
        {
            var input = 0;

            Assert.Throws <InvalidOperationException>(() => RepeatedString.GetTotal("a", input));
        }
Beispiel #11
0
 public void InputStringIsInvalid_ThrowException(string input)
 {
     Assert.Throws <InvalidOperationException>(() => RepeatedString.GetTotal(input, 1));
 }