public HomeModule() { Get["/"] = _ => View["index.cshtml"]; Post["/count_repeats"] = _ => { RepeatCounter newRepeatCounter = new RepeatCounter(); int repeats = newRepeatCounter.CountRepeats(Request.Form["search-string"], Request.Form["search-word"]); string repeatDisplay = newRepeatCounter.DisplayNumberOfRepeats(repeats); return View["result.cshtml", repeatDisplay]; }; }
public void CountRepeats_AllFullMatches_3() { RepeatCounter newRepeatCounter = new RepeatCounter(); Assert.Equal(2, newRepeatCounter.CountRepeats("cat by the cat", "cat")); }
public void CountRepeats_TotalMismatch_0() { RepeatCounter newRepeatCounter = new RepeatCounter(); Assert.Equal(0, newRepeatCounter.CountRepeats("the cat in the cathedral", "dog")); }
public void CountRepeats_Validation_Negative1() { RepeatCounter newRepeatCounter = new RepeatCounter(); Assert.Equal(-1, newRepeatCounter.CountRepeats("scat cat cats", "cat dog")); }
public void CountRepeats_SpacedFullMatches_1() { RepeatCounter newRepeatCounter = new RepeatCounter(); Assert.Equal(1, newRepeatCounter.CountRepeats("the scatter cat cathedral building", "cat")); }
public void CountRepeats_PunctuatedFullMatches_2() { RepeatCounter newRepeatCounter = new RepeatCounter(); Assert.Equal(2, newRepeatCounter.CountRepeats("the 'cat' cat.", "cat")); }
public void CountRepeats_MatchChunkAtEnd_0() { RepeatCounter newRepeatCounter = new RepeatCounter(); Assert.Equal(0, newRepeatCounter.CountRepeats("casablanca", "cat")); }
public void CountRepeats_ExactMatch_1() { RepeatCounter newRepeatCounter = new RepeatCounter(); Assert.Equal(1, newRepeatCounter.CountRepeats("cat", "cat")); }
public void CountRepeats_CloseToMatchStartAndEnd_1() { RepeatCounter newRepeatCounter = new RepeatCounter(); Assert.Equal(1, newRepeatCounter.CountRepeats("scat cat cats", "cat")); }