コード例 #1
0
ファイル: HomeModule.cs プロジェクト: RubyBe/wordcounter
    public HomeModule()
    {
        Get["/"] = _ =>
        {
          return View["index.html"];
        };

        Post["/result"] = _ =>
        {
          RepeatCounter formRepeatCounter = new RepeatCounter(Request.Form["input-word"], Request.Form["input-list"]);
          string firstString = formRepeatCounter.GetStringOfWords();
          string cleanString = formRepeatCounter.RemovePunctuation(firstString);
          string findWord = formRepeatCounter.GetWord();
          int countWords = formRepeatCounter.CountRepeats(findWord, cleanString);
          return View["result.cshtml", formRepeatCounter];
        };

        Post["/warandpeace"] = _ =>
        {
          RepeatCounter wapRepeatCounter = new RepeatCounter(Request.Form["input-word"], Request.Form["input-word"]);
          string readWarAndPeace = wapRepeatCounter.ReadAFile();
          wapRepeatCounter.SetStringOfWords(readWarAndPeace);
          string firstString = wapRepeatCounter.GetStringOfWords();
          string cleanString = wapRepeatCounter.RemovePunctuation(firstString);
          string findWord = wapRepeatCounter.GetWord();
          int countWords = wapRepeatCounter.CountRepeats(findWord, cleanString);
          return View["warandpeace.cshtml", wapRepeatCounter];
        };
    }
コード例 #2
0
ファイル: RepeatCounterTest.cs プロジェクト: Rouz1130/word
        public void Test6_RegognizeWordInSentence_true()
        {
            RepeatCounter checkNewWord = new RepeatCounter("the", "the blue jays rock");

              int result = checkNewWord.CountRepeats();

              Assert.Equal(1, result);
        }
コード例 #3
0
ファイル: RepeatCounterTest.cs プロジェクト: Rouz1130/word
        public void Test5_recognizesWordNotPresent_true()
        {
            RepeatCounter checkNewWord = new RepeatCounter("the", "blue jays rock");

              int result = checkNewWord.CountRepeats();

              Assert.Equal(0, result);
        }
コード例 #4
0
ファイル: RepeatCounterTest.cs プロジェクト: Rouz1130/word
        public void Test7_RecognizeMulitipleWordsInSentence_true()
        {
            RepeatCounter checkNewWord = new RepeatCounter("the", "the blue jays rock the theater");

              int result = checkNewWord.CountRepeats();

              Assert.Equal(2, result);
        }
コード例 #5
0
ファイル: RepeatCounterTest.cs プロジェクト: Rouz1130/word
        public void Test2_LetterDontMatch_true()
        {
            //arrange
              RepeatCounter checkNewWord = new RepeatCounter("a", "b");
              //act
              int result = checkNewWord.CountRepeats();

              //Assert
              Assert.Equal(0, result);
        }
コード例 #6
0
ファイル: RepeatCounterTest.cs プロジェクト: Rouz1130/word
        public void Test1_RepeatCounterGetA_true()
        {
            //arrange
              RepeatCounter checkNewWord = new RepeatCounter("a", "a");
              //act
              int result = checkNewWord.CountRepeats();

              //Assert
              Assert.Equal(1, result);
        }
コード例 #7
0
ファイル: HomeModule.cs プロジェクト: Rouz1130/word
        public HomeModule()
        {
            Get["/"] = _ => {
            return View["index.cshtml"];
              };

              Post["/result"] = _ => {
            RepeatCounter newWord = new RepeatCounter ( Request.Form["new-word"], Request.Form["new-sentence"]);
            return View["result.cshtml", newWord];
              };
        }
コード例 #8
0
ファイル: RepeatCounterTest.cs プロジェクト: Rouz1130/word
        public void Test4_TwoWordsReturnOne_true()
        {
            //arrange
              RepeatCounter checkNewWord = new RepeatCounter("and", "and");

              //act
              int result = checkNewWord.CountRepeats();

              //Assert
              Assert.Equal(1, result);
        }
コード例 #9
0
 public void FindWord_FindsWordInStringOfMultipleWords_DisplaysTrueIfFound()
 {
     // Arrange
       string testWord = "antelope";
       string testString = "An antelope is like a gazelle in a way but it begins with an A actually.";
       RepeatCounter testRepeatCounter = new RepeatCounter(testWord, testString);
       // Act
       string resultString = testRepeatCounter.FindWord(testWord, testString);
       // Assert
       Console.WriteLine("Spec 4 expected: " + testString + " Spec 4 actual: " + resultString);
       Assert.Equal(resultString, "True");
 }
コード例 #10
0
 public void CountRepeats_CountsWordReptitionInStringOfMultipleWords_ReturnsCountOfRepeats()
 {
     // Arrange
       string testWord = "antelope";
       string testString = "An antelope is like a gazelle in a way but it begins with an A actually.";
       int testCount = 1;
       RepeatCounter testRepeatCounter = new RepeatCounter(testWord, testString);
       // Act
       int resultCount = testRepeatCounter.CountRepeats(testWord, testString);
       // Assert
       Console.WriteLine("Spec 5 expected: " + testCount + " Spec 5 actual: " + resultCount);
       Assert.Equal(testCount, resultCount);
 }
コード例 #11
0
        public HomeModule()
        {
            Get["/"] = _ => {
                return(View["index.cshtml"]);
            };

            Post["/result"] = _ => {
                string        sentence   = Request.Form["sentence"];
                string        wordSelect = Request.Form["word"];
                RepeatCounter newCounter = new RepeatCounter(sentence, wordSelect);
                return(View["results.cshtml", newCounter]);
            };
        }
コード例 #12
0
ファイル: Program.cs プロジェクト: MMAlaeddin/WordCounter
        public static void Main()
        {
            Console.WriteLine("Welcome to the Word Counter!");
            Console.WriteLine("Please enter a word");
            string newWord = Console.ReadLine();

            Console.WriteLine("Please ender a sentence");
            string        newSentence = Console.ReadLine();
            RepeatCounter newCounter  = new RepeatCounter(newWord, newSentence);
            int           finalOutput = newCounter.CountWord();

            Console.WriteLine("your word " + "~ " + newWord + " ~" + " repeats " + finalOutput + " time(s) in your sentence.");
        }
コード例 #13
0
 public void FindWord_FindsWordInStringOfMultipleWordsCapitalizedOrNot_ReturnsCountOfRepeatsRegardlessOfCase()
 {
     // Arrange
       string inputWord = "a";
       string testWord = inputWord.ToUpper();
       string testString = "An antelope is like a gazelle in a way but it begins with an A actually.";
       int testCount = 3;
       RepeatCounter testRepeatCounter = new RepeatCounter(testWord, testString);
       // Act
       int resultCount = testRepeatCounter.CountRepeats(testWord, testString);
       // Assert
       Console.WriteLine("Spec 6 expected: " + testCount + " Spec 6 actual: " + resultCount);
       Assert.Equal(testCount, resultCount);
 }
コード例 #14
0
        static void Main()
        {
            Welcome();
            Console.WriteLine("Please enter a word.");
            string Word = Console.ReadLine();

            Console.WriteLine("Please enter a sentence that uses that word at least once.");
            string        Sentence   = Console.ReadLine();
            RepeatCounter NeedsCount = new RepeatCounter(Word, Sentence);

            NeedsCount.ValidInputCheck(Word);
            NeedsCount.ValidInputCheck(Sentence);
            Console.WriteLine("Your sentence contains the word " + Word + " " + NeedsCount.WordCount() + " time(s).");
        }
コード例 #15
0
        public HomeModule()
        {
            Get["/"] = _ =>
            {
                return(View["index.cshtml"]);
            };

            Post["/count"] = _ =>
            {
                RepeatCounter newRepeatCounter = new RepeatCounter(Request.Form["search-word"], Request.Form["search-string"]);
                newRepeatCounter.CountRepeats();
                return(View["word_count.cshtml", newRepeatCounter]);
            };
        }
コード例 #16
0
        public static void Main()
        {
            System.Console.WriteLine("Find the word in the sentence!");
            System.Console.WriteLine("Please enter a word: ");
            string userWord = Console.ReadLine();

            System.Console.WriteLine("Please enter the sentence you'd like to search: ");
            string        userSentence     = Console.ReadLine();
            RepeatCounter newRepeatCounter = new RepeatCounter(userWord, userSentence);
            int           result           = newRepeatCounter.GetOccurenceCount();

            System.Console.WriteLine("------------------------------------");
            System.Console.WriteLine($"The word {userWord} appeared {result} time(s) in the sentence: '{userSentence}'");
        }
コード例 #17
0
            public static void Main()
            {
                Console.WriteLine("Enter a word");
                string inputWord = Console.ReadLine();

                Console.WriteLine("Enter a sentence or list of words");
                string inputSentence = Console.ReadLine();

                RepeatCounter newRepeatCounter = new RepeatCounter(inputWord, inputSentence);

                int count = newRepeatCounter.CountMatching();

                Console.WriteLine("The word *" + inputWord + "*" + " was entered " + count + " times");
            }
コード例 #18
0
 public static string GetUserWord()
 {
     try
     {
         Console.WriteLine("\n Please enter a word:");
         string userInput = Console.ReadLine();
         string userWord  = RepeatCounter.ValidateWord(userInput);
         return(userWord);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return("error");
     }
 }
コード例 #19
0
        public void Test1_RepeatCounterGetA_true()
        {
            //arrange
            string word = "a";
            RepeatCounter checkNewWord = new RepeatCounter(word,"");

            //act.....
            string checkWord = checkNewWord.GetWord();

            //Assert
            Assert.Equal(word, checkWord);

            // Test2_RepeatCounterGetThe_true()
              //
        }
コード例 #20
0
        public HomeModule()
        {
            Get["/"] = _ => {
                return(View["index.cshtml"]);
            };

            Get["/results"] = _ => {
                return(View["index.cshtml"]);
            };

            Post["/results"] = _ => {
                RepeatCounter newRepeatCounter = new RepeatCounter(Request.Form["user-word"], Request.Form["user-sentence"]);
                return(View["results.cshtml", newRepeatCounter]);
            };
        }
コード例 #21
0
 public static string GetUserSentence()
 {
     try
     {
         Console.WriteLine("\n Please enter a sentence:");
         string inputSentence = Console.ReadLine();
         string userSentence  = RepeatCounter.ValidateSentence(inputSentence);
         return(userSentence);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return("error");
     }
 }
コード例 #22
0
        public static void Main()
        {
            Console.WriteLine("Welcome, please enter a sentence and a word to check the occurence of your word in your sentence.");
            Console.WriteLine("Enter a sentence: ");
            string userInputSentence = Console.ReadLine();

            Console.WriteLine("Enter a word: ");
            string        userInputWord    = Console.ReadLine();
            RepeatCounter newUserInput     = new RepeatCounter(userInputWord, userInputSentence);
            string        userWord         = newUserInput.GetUserWord();
            string        userSentence     = newUserInput.GetUserSentence();
            int           resultCheckCount = Check.CheckNumberOccurence(userSentence, userWord);

            Console.WriteLine("Your word appears " + resultCheckCount + " times in your sentence.");
        }
コード例 #23
0
        public static void Main()
        {
            string word     = RepeatCounter.GrabWord();
            string sentence = RepeatCounter.GrabSentence();
            int    counter  = RepeatCounter.userStringToCounter(word, sentence);

            if (counter > 0)
            {
                Console.WriteLine("Your word appeared this many times:" + counter);
            }
            else
            {
                Console.WriteLine("Couldn't find your word")
            }
        }
コード例 #24
0
ファイル: Program.cs プロジェクト: spodolak/Wordcounter
        //Adds user input to back end constructor. Will notify user if inputted word is not a 'real' word.
        public static string GetWord()
        {
            Console.WriteLine("Enter a word: ");
            string word = Console.ReadLine();

            if (RepeatCounter.IsAWord(word))
            {
                return(word.ToLower());
            }
            else
            {
                Console.WriteLine("Hey, That's not a real word! But I'll search for it anyway");
                return(word);
            }
        }
コード例 #25
0
        public static void Main()
        {
            Console.WriteLine("Hello, world! Welcome to The Word Counter Extraordinaire.");
            Console.WriteLine("Please enter a word.");
            string userWord = Console.ReadLine().ToLower();

            Console.WriteLine("Great! Now please enter a sentence.");
            string userSentence = Console.ReadLine().ToLower();

            RepeatCounter newCounter    = new RepeatCounter(userWord, userSentence);
            int           wordInstances = newCounter.CountWordInSentence();

            Console.WriteLine("The word " + "'" + userWord + "'" + " appears " + wordInstances + " times in " + "'" + userSentence + "'");

            Console.WriteLine("Thanks for playing!");
        }
コード例 #26
0
        public HomeModule()
        {
            //Routing to the HomePage
            Get["/"] = _ => {
                return(View["index.cshtml"]);
            };

            //Routing to the Result Page

            Post["/result"] = _ => {
                RepeatCounter newRepeatCounter = new RepeatCounter();
                string        result           = newRepeatCounter.CountRepeats(Request.Form["inputWord"], Request.Form["inputSentence"]);
                string[]      countResultData  = { Request.Form["inputSentence"], Request.Form["inputWord"], result };
                return(View ["results.cshtml", countResultData]);
            };
        }
コード例 #27
0
        public static void Main()
        {
            Console.Clear();
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            TypeLine("Hello Word Conter");
            TypeLine("To start playing first enter a word");
            string word = Console.ReadLine().ToLower();

            Console.ForegroundColor = ConsoleColor.DarkGreen;
            TypeLine("Now enter a sentence");
            string        sentence   = Console.ReadLine().ToLower();
            RepeatCounter newCounter = new RepeatCounter(word, sentence);
            int           userResult = newCounter.RepeatWord();

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("The word you entered " + word + "repeats " + userResult + " times in your sentence.");
        }
コード例 #28
0
 public void FindWord_FindsWordInStringOfMultipleWordsWithPunchtuation_ReturnsCountOfRepeatsRegardlessOfPunctuation()
 {
     // Arrange
       string inputWord = "actually";
       string testWord = inputWord.ToUpper();
       string testString = "An antelope is like a gazelle in a way but it begins with an A actually.";
       int testCount = 1;
       int resultCount = 0;
       RepeatCounter testRepeatCounter = new RepeatCounter(testWord, testString);
       string testCleanString = testRepeatCounter.RemovePunctuation(testString);
       // Act
       Console.WriteLine("Spec 7 pre-method-call resultCount value: " + resultCount);
       resultCount = testRepeatCounter.CountRepeats(testWord, testCleanString);
       // Assert
       Console.WriteLine("Spec 7 expected: " + testCount + " Spec 7 actual: " + resultCount);
       Assert.Equal(testCount, resultCount);
 }
コード例 #29
0
        public static void Main()
        {
            Console.Clear();
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            TypeLine("Welcome to the Word Counter program");
            string        inputWord = GetWord();
            RepeatCounter newCount  = new RepeatCounter();
            bool          wordValid = newCount.ValidateWord(inputWord);
            bool          realWord  = newCount.DictionaryCheck(inputWord);

            // if the filepath for the dictionary text file is not working properly, the program will exit after you enter the first word.  to bypass this, comment out line 16 and use the bool value for realWord from line 18 instead
            // bool realWord = true;
            if (wordValid)
            {
                if (!realWord)
                {
                    DoesntExist();
                }
                string inputSent = GetSentence();
                bool   sentValid = newCount.ValidateSentence(inputSent);
                if (sentValid)
                {
                    int result = newCount.CountWords();
                    Console.Clear();
                    Console.Write(Environment.NewLine);
                    if (result == 1)
                    {
                        TypeLine("The word '" + newCount.RootWord + "' appears in the sentence you entered only " + result + " time. Yay!");
                        PlayAgain();
                    }
                    else
                    {
                        TypeLine("The word '" + newCount.RootWord + "' appears in the sentence you entered " + result + " times. Yay!");
                        PlayAgain();
                    }
                }
                else if (!sentValid)
                {
                    ErrorMessage("sentence");
                }
            }
            else
            {
                ErrorMessage("word");
            }
        }
コード例 #30
0
        public static void AskUser()
        {
            Console.WriteLine(">>> Enter a word to search for:");
            string searchFor = Console.ReadLine();

            newRepeatCounter = new RepeatCounter(searchFor);
            if (newRepeatCounter.IsValidInput())
            {
                Console.WriteLine(">>> Enter a sentence:");
                string sentence = Console.ReadLine();
                newRepeatCounter = new RepeatCounter(searchFor, sentence);
            }
            else
            {
                Console.WriteLine(">>> Invalid input. Please enter only 1 word.");
                AskUser();
            }
        }
コード例 #31
0
        public static void Main()
        {
            RepeatCounter Words123 = new RepeatCounter();

            Console.WriteLine("Please enter a sentence.");
            string UserPhrase = Console.ReadLine();

            Console.WriteLine("Please enter a word the check the previous sentence with.");
            string UserWord = Console.ReadLine();

            while (UserWord.Contains(" "))
            {
                Console.WriteLine("Please enter a single word.");
                UserWord = Console.ReadLine();
            }
            int CountWords = Words123.wordCounter(UserPhrase, UserWord);

            Console.WriteLine(UserWord + " appears in (" + UserPhrase + ") " + CountWords + " times.");
        }
コード例 #32
0
ファイル: WordCounter.cs プロジェクト: sonekase/Word-Counter
        public static void Main()
        {
            Console.WriteLine("Enter Your Word.");
            string        firstWord = Console.ReadLine();
            RepeatCounter wordCount = new RepeatCounter(firstWord);

            Console.WriteLine("Enter Your Sentence.");
            string enterSentence = Console.ReadLine();
            int    wordSum       = wordCount.CountWord(enterSentence);

            Console.WriteLine("Your Word Appears " + wordSum);
            Console.WriteLine("Would You Like To Restart: Y/N");
            string restartGame = Console.ReadLine();

            if (restartGame.Equals("Y"))
            {
                Main();
            }
        }
コード例 #33
0
        public static void CountWord()
        {
            Console.Clear();
            Console.WriteLine("Welcome, please enter a sentence and a word to check the occurence of your word in your sentence.");
            Console.Write("Enter a sentence: ");
            string userSentence = Console.ReadLine().ToLower();

            Console.Write("Enter a word: ");
            string        userWord     = Console.ReadLine().ToLower();
            RepeatCounter newUserInput = new RepeatCounter(userWord, userSentence);

            if (RepeatCounter.CheckValidInput() == true)
            {
                Console.WriteLine($"Your word \"{userWord}\" appears {RepeatCounter.SearchWords()} times in your sentence.");
            }
            else
            {
                Console.WriteLine($"Your word \"{userWord}\" does not exist in your sentence \"{userSentence}\"");
            }
        }
コード例 #34
0
ファイル: Program.cs プロジェクト: TTeigen/wordCounterIProj
        //Method that combines the cleaner with the counter from the backend
        public static void resultPrinter(string sentence, string word)
        {
            string cleaned = RepeatCounter.sentenceCleaner(sentence);
            int    occur   = RepeatCounter.countRepeats(cleaned, word);

            if (occur > 0)
            {
                Console.Write("Your word ");
                Console.ForegroundColor = ConsoleColor.Blue;
                Console.Write($"'{word}' ");
                Console.ResetColor();
                Console.Write("repeats in the sentence you supplied ");
                Console.ForegroundColor = ConsoleColor.Blue;
                Console.Write($"{occur} ");
                Console.ResetColor();
                Console.Write("time(s).");
            }
            else
            {
                Console.WriteLine($"Looks like {word} does not exist in your sentence or there was a typo.");
            }
        }
コード例 #35
0
ファイル: Program.cs プロジェクト: djzevenbergen/WordCounter
        public static bool RunProgramLoop()
        {
            bool view = false;

            string[] inputs = ReturnValidStrings();

            RepeatCounter newCounter = new RepeatCounter(inputs[0], inputs[1]);
            string        t          = "";

            if (newCounter.GetCount() > 1)
            {
                t = "times";
            }
            else
            {
                t = "time";
            }
            Console.WriteLine($"The word '{newCounter.Word}' appears {newCounter.GetCount()} {t} in the sentence '{newCounter.Sentence}' ");


            if (RepeatCounter.GetInstances().Count > 0)
            {
                Console.WriteLine("");
                Console.WriteLine("If you want to try again, press Enter.");
                Console.WriteLine("If you want to [V]iew your previous entries, press V and enter.");
                string resp = Console.ReadLine().ToLower();
                if (resp == "v")
                {
                    view = true;
                }
                else
                {
                    view = false;
                }
            }

            return(view);
        }
コード例 #36
0
        public static void Main()
        {
            Console.WriteLine("Welcome to Word Counter!");
            Console.WriteLine("Enter a sentence:");
            string sentence = Console.ReadLine();

            Console.WriteLine("Enter a number you want us to count:");
            string        word             = Console.ReadLine();
            RepeatCounter newRepeatCounter = new RepeatCounter(sentence, word);

            Console.WriteLine("--------");
            Console.WriteLine("The word " + "(" + newRepeatCounter.Word + ")" + " is displayed " + newRepeatCounter.GetRepeatWordFrequency() + " times within your sentence.");
            Console.WriteLine("--------");
            Console.WriteLine("Would you like to play again? Enter Yes or No");
            string userInput1 = Console.ReadLine().ToLower();

            if (userInput1 == "yes")
            {
                Main();
            }
            else if (userInput1 == "no")
            {
                Console.WriteLine("Thanks for playing!");
            }
            else
            {
                Console.WriteLine("Sorry we didn't get that. Please enter 'Yes' to play again, or 'No' to quit");
                string userInput2 = Console.ReadLine();
                if (userInput2 == "yes")
                {
                    Main();
                }
                else
                {
                    Console.WriteLine("Thanks for playing!");
                }
            }
        }
コード例 #37
0
        public static void StartWordCounter()
        {
            string validatedWord = GetUserWord();

            if (validatedWord == "invalid input")
            {
                Console.Clear();
                Console.WriteLine($"\n {validatedWord}");
                StartWordCounter();
            }
            else if (validatedWord == "error")
            {
                StartWordCounter();
            }
            else
            {
                string validatedSentence = GetUserSentence();
                if (validatedSentence == "invalid input")
                {
                    Console.Clear();
                    string confusedArt = @"¯\_(ツ)_/¯";
                    Console.WriteLine($"\n {validatedSentence} \n \n {confusedArt} \n Let's try this again, from the beginning!");
                    StartWordCounter();
                }
                else if (validatedSentence == "error")
                {
                    StartWordCounter();
                }
                else
                {
                    Console.Clear();
                    RepeatCounter.AddMatchesToList(validatedWord, validatedSentence);
                    DisplayNumberOfMatches(validatedWord, validatedSentence);
                }
            }
        }
コード例 #38
0
ファイル: Program.cs プロジェクト: mtaylorpdx/WordCounter
        public static void Main()
        {
            Console.Write("Enter a single word: ");
            string        inputWord = Console.ReadLine();
            RepeatCounter counter   = new RepeatCounter(inputWord);

            Console.Write("Enter a series of words: ");
            string inputSentence = Console.ReadLine();

            inputWord     = counter.RemovePunctuation(inputWord);
            inputSentence = counter.RemovePunctuation(inputSentence);
            counter       = new RepeatCounter(inputWord, inputSentence);

            if ((counter.StringCheck(counter.SingleWord)) && (counter.StringCheck(counter.MultipleWords)) && (counter.SpaceCheck(counter.SingleWord)) && (counter.LetterCheck(counter.MultipleWords)))
            {
                int countResult = counter.AddCount(counter.SplitString(counter.MultipleWords));
                Console.WriteLine("Total matches: " + countResult);
            }
            else
            {
                Console.WriteLine("Please enter both a single word and a sentence.");
                Main();
            }
        }
コード例 #39
0
        public void RepeatCounterTest1_Identical_True()
        {
            RepeatCounter testRepeatCounter = new RepeatCounter("A", "A");

            Assert.Equal(1, testRepeatCounter.CountRepeats());
        }
コード例 #40
0
        public void RepeatCounterTest_PartialMatches_False()
        {
            RepeatCounter testRepeatCounter = new RepeatCounter("ham", "I love ham on hamburgers");

            Assert.Equal(1, testRepeatCounter.CountRepeats());
        }
コード例 #41
0
        public void RepeatCounterTest_Count_True()
        {
            RepeatCounter testRepeatCounter = new RepeatCounter("A", "A A A");

            Assert.Equal(3, testRepeatCounter.CountRepeats());
        }
コード例 #42
0
        public void RepeatCounter_Test3_SplitInput2Sentence_ReturnWordCount()
        {
            RepeatCounter newCountRepeats = new RepeatCounter("I", "I am who I say I am");

            Assert.Equal(3, newCountRepeats.CountRepeats());
        }
コード例 #43
0
 public void RepeatCounter_CreatesARepeatCounterObjectWithTwoStrings_ReturnsValueOfTwoStrings()
 {
     // Arrange
       string testWord = "antelope";
       string testString = "An antelope is like a gazelle in a way but it begins with an A actually.";
       // Act
       RepeatCounter testRepeatCounter = new RepeatCounter(testWord, testString);
       string resultWord = testRepeatCounter.GetWord();
       string resultString = testRepeatCounter.GetStringOfWords();
       // Assert
       Console.WriteLine("Spec 1 expected: " + testWord + " Spec 1 actual: " + resultWord);
       Console.WriteLine("Spec 2 expected: " + testString + " Spec 2 actual: " + resultString);
       Assert.Equal(testWord, resultWord);
       Assert.Equal(testString, resultString);
 }
コード例 #44
0
 static void Main()
 {
     RepeatCounter.InitApp();
 }