Exemplo n.º 1
0
        public void AlreadyContainsOccurencesOf_Returns_ExpectedResults()
        {
            var input  = "CDXCCDDE";
            var result = StringExtensions.AlreadyContainsOccurencesOf(input, "CD", 2);

            Assert.IsTrue(result);

            input  = "CDXC";
            result = StringExtensions.AlreadyContainsOccurencesOf(input, "CD", 2);
            Assert.IsFalse(result);

            input  = "ABCEFABEFECDEFCD";
            result = StringExtensions.AlreadyContainsOccurencesOf(input, "EF", 3);
            Assert.IsTrue(result);

            input  = "ABCEFABEFECDEFCD";
            result = StringExtensions.AlreadyContainsOccurencesOf(input, "EF", 4);
            Assert.IsFalse(result);

            input  = "ABDCDCDEFEFEF";
            result = StringExtensions.AlreadyContainsOccurencesOf(input, "CD", 2);
            Assert.IsTrue(result);

            input  = "ABCEFABEFECDFACD";
            result = StringExtensions.AlreadyContainsOccurencesOf(input, "EF", 3);
            Assert.IsFalse(result);
        }