Exemplo n.º 1
0
 public HomeModule()
 {
     Get["/"] = _ => View["index.cshtml"];
       Post["/new-phrase"] = _ => {
     Phrase newPhrase = new Phrase ();
     string resultPhrase = newPhrase.CustomReplace(Request.Form["phrase-input"], Request.Form["word-replace"], Request.Form["new-word"], Request.Form["case-sensitivity"], Request.Form["partial-matches"]);
     return View["index.cshtml", resultPhrase];
       };
 }
Exemplo n.º 2
0
 public void CustomReplace_OneWord_Replaces()
 {
     Phrase newPhrase = new Phrase ();
       Assert.Equal("Hello universe", newPhrase.CustomReplace("Hello world", "world", "universe", true, true));
 }
Exemplo n.º 3
0
 public void CustomReplace_CaseInsensitive_Replaces()
 {
     Phrase newPhrase = new Phrase ();
       Assert.Equal("Hello universe", newPhrase.CustomReplace("Hello World", "world", "universe", false, false));
 }
Exemplo n.º 4
0
 public void CustomReplace_FullWord_Replaces()
 {
     Phrase newPhrase = new Phrase ();
       Assert.Equal("The dog in the cathedral", newPhrase.CustomReplace("The cat in the cathedral", "cat", "dog", true, false));
 }