コード例 #1
0
        public void DoesNotMatchPartialWordTest()
        {
            //Arrange
            WordCounter wordCounter = new WordCounter("Hello how are you?", "ow");

            //Act
            int result = wordCounter.CountWordInstances();

            //Assert
            Assert.AreEqual(0, result);
        }
コード例 #2
0
        public void DoesMatchFullWordTest()
        {
            //Arrange
            WordCounter wordCounter = new WordCounter("Hello how are you? How did I pass this?", "how");

            //Act
            int result = wordCounter.CountWordInstances();

            //Assert
            Assert.AreEqual(2, result);
        }
コード例 #3
0
        public ActionResult Results()//WordCounter newFind)
        {
            //var otherResult = new WordCount() { Text ="" };
            //otherResult.Text = "";
            string      text    = Request.Form["text"];
            string      find    = Request.Form["find"];
            WordCounter newFind = new WordCounter(text, find);

            newFind.CountWordInstances();
            return(View(newFind));
        }