コード例 #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]);
            };
        }
コード例 #2
0
        public void FindAndReplaceTest_ForUserInputa_b()
        {
            FindAndReplace testLetter = new FindAndReplace();

            Assert.Equal("b", testLetter.FindAndReplaceResult("a", "a", "b"));
        }
コード例 #3
0
        public void FindAndReplaceTest_ForUserInputSelectedPartWord_sentence()
        {
            FindAndReplace testSentence = new FindAndReplace();

            Assert.Equal("My cat loves hotcats", testSentence.FindAndReplaceResult("My dog loves hotdogs", "dog", "cat"));
        }
コード例 #4
0
        public void FindAndReplaceTest_ForUserInputSelectWord_word()
        {
            FindAndReplace testWord = new FindAndReplace();

            Assert.Equal("Hello universe", testWord.FindAndReplaceResult("Hello world", "world", "universe"));
        }
コード例 #5
0
        public void FindAndReplaceTest_ForUserInputCaplitalization_capitalization()
        {
            FindAndReplace testCapitalization = new FindAndReplace();

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