예제 #1
0
        public void CanFindRepeatedWord()
        {
            string testString = "Once upon a time in a galaxy far, far away...";
            string result     = RepeatedWord.RepeatedWords(testString);

            Assert.Equal("a", result);
        }
예제 #2
0
        public void Find_A_Repeating_Word_Despite_Case()
        {
            string testString = "Here is a string.  It has the word here twice.";
            string actual     = RepeatedWord.RepeatWord(testString);
            string expected   = "here";

            Assert.Equal(expected, actual);
        }
예제 #3
0
        public void CanReturnRepeatedWordsTest()
        {
            string inputStr = "Once upon a time there was a brave princess who";

            string outputStr = RepeatedWord.FirstRepeating(inputStr);

            Assert.Equal("a", outputStr);
        }
예제 #4
0
        public void Successfully_Return_The_First_Repeated_Word()
        {
            string input    = "Once upon a time, there was a brave princess who";
            string actual   = RepeatedWord.RepeatWord(input);
            string expected = "a";

            Assert.Equal(expected, actual);
        }
예제 #5
0
        public void Successfully_Strip_A_String_Of_Punctuation()
        {
            string testString = "Here is a string, it has some words, and some puncuation.";
            string actual     = RepeatedWord.StripPunctuation(testString);
            string expected   = "Here is a string it has some words and some puncuation";

            Assert.Equal(expected, actual);
        }
예제 #6
0
        public void Successfully_Split_A_String_Into_An_Array()
        {
            string testString = "Here is a string, it has some words, and some puncuation.";

            string[] actual   = RepeatedWord.SplitString(testString);
            string[] expected = new string[]
            {
                "Here", "is", "a", "string", "it", "has", "some", "words", "and", "some", "puncuation"
            };
            Assert.Equal(expected, actual);
        }
예제 #7
0
        public void FirstRepeatReturnsFirstRepeatedWord(string expect, string val)
        {
            var words = new RepeatedWord(val);

            Assert.Equal(expect, words.FirstRepeat());
        }
예제 #8
0
        public void Return_Null_If_Input_String_Is_Empty()
        {
            string input = "";

            Assert.Null(RepeatedWord.RepeatWord(input));
        }
예제 #9
0
        public void Reutrn_Null_If_There_Are_No_Repeats()
        {
            string input = "There are no repeats in this sentence.";

            Assert.Null(RepeatedWord.RepeatWord(input));
        }