Exemple #1
0
        public HomeModule()
        {
            Get["/"] = _ => {
                return(View["index.cshtml"]);
            };

            Post["/"] = _ => {
                FindAndReplace newFindAndReplace = new FindAndReplace(Request.Form["sentence"], Request.Form["replace"], Request.Form["new"]);
                string         finalResult       = newFindAndReplace.ReplaceFindWord();
                return(View["index.cshtml", finalResult]);
            };
        }
        public void FindAndReplaceTest_ForUserInputa_b()
        {
            FindAndReplace testLetter = new FindAndReplace();

            Assert.Equal("b", testLetter.FindAndReplaceResult("a", "a", "b"));
        }
        public void FindAndReplaceTest_ForUserInputSelectedPartWord_sentence()
        {
            FindAndReplace testSentence = new FindAndReplace();

            Assert.Equal("My cat loves hotcats", testSentence.FindAndReplaceResult("My dog loves hotdogs", "dog", "cat"));
        }
        public void FindAndReplaceTest_ForUserInputSelectWord_word()
        {
            FindAndReplace testWord = new FindAndReplace();

            Assert.Equal("Hello universe", testWord.FindAndReplaceResult("Hello world", "world", "universe"));
        }
        public void FindAndReplaceTest_ForUserInputCaplitalization_capitalization()
        {
            FindAndReplace testCapitalization = new FindAndReplace();

            Assert.Equal("My CAT loves hotCATs", testCapitalization.FindAndReplaceResult("My doG loVes hotDogs", "dog", "cat"));
        }