コード例 #1
0
        public void RepeatCounterUI_WillCreateAnInstanceListUponCreation_true()
        {
            RepeatCounter model = new RepeatCounter();

            model.CountRepeats("cats", "i just love cats and their little faces", "spaces");
            List <RepeatCounter> models = new List <RepeatCounter>()
            {
            };

            models = RepeatCounter.GetAll();
            Console.WriteLine("You searched for: " + model.GetWord());
            Console.WriteLine("In this sentence: " + model.GetSentence());
            Console.WriteLine("And it matched: " + model.GetCount() + " times");
        }
コード例 #2
0
 public HomeModule()
 {
     Get["/"] = _ => {
         return(View["index.cshtml"]);
     };
     Post["/search"] = _ => {
         RepeatCounter model = new RepeatCounter();
         model.CountRepeats(Request.Form["word"], Request.Form["sentence"], Request.Form["command"]);
         List <RepeatCounter> allCounts = new List <RepeatCounter>()
         {
         };
         allCounts = RepeatCounter.GetAll();
         return(View["result.cshtml", allCounts]);
     };
     Post["/boom"] = _ => {
         RepeatCounter model = new RepeatCounter();
         RepeatCounter.ClearAll();
         return(View["cleared.cshtml", model]);
     };
 }
コード例 #3
0
        public void CountRepeats_WillReturn1IfOneMatch_true()
        {
            RepeatCounter model = new RepeatCounter();

            Assert.Equal(1, model.CountRepeats("cats", "i just love cats and their little faces", "spaces"));
        }
コード例 #4
0
        public void CountRepeats_WillReturn3IfMatchingThreeTimes_true()
        {
            RepeatCounter model = new RepeatCounter();

            Assert.Equal(3, model.CountRepeats("coding", "i love surf coding, coding adventures, all coding", "spaces"));
        }
コード例 #5
0
        public void CountRepeats_WillReturn2IfMatchTwice_true()
        {
            RepeatCounter model = new RepeatCounter();

            Assert.Equal(2, model.CountRepeats("cats", "i just love cats and their cats furriness", "spaces"));
        }