public void When_invalid_haiku_parsed_result_is_false()
        {
            HaikuParser hp = new HaikuParser();

            hp.ParseHaiku("computer programs/the bugs try to eat my code/i will not let them");

            Assert.IsFalse(hp.IsHaiku());
        }
        public void When_valid_haiku_parsed_result_is_true()
        {
            HaikuParser hp = new HaikuParser();

            hp.ParseHaiku("happy purple frog/eating bugs in the marshes/get indigestion");

            Assert.IsTrue(hp.IsHaiku());
        }
        public void When_valid_haiku_parsed_syllables_are_as_expected1()
        {
            HaikuParser hp = new HaikuParser();

            hp.ParseHaiku("happy purple frog/eating bugs in the marshes/get indigestion");

            Assert.That(hp.HaikuLine.Sentence1.Value == 5);
            Assert.That(hp.HaikuLine.Sentence2.Value == 7);
            Assert.That(hp.HaikuLine.Sentence3.Value == 5);
        }
        public void When_valid_haiku_parsed_sentences_are_correct2()
        {
            HaikuParser hp = new HaikuParser();

            hp.ParseHaiku("computer programs/the bugs try to eat my code/i will not let them");

            Assert.That(hp.HaikuLine.Sentence1.Key == "computer programs");
            Assert.That(hp.HaikuLine.Sentence2.Key == "the bugs try to eat my code");
            Assert.That(hp.HaikuLine.Sentence3.Key == "i will not let them");
        }
        public void When_valid_haiku_parsed_sentences_are_correct1()
        {
            HaikuParser hp = new HaikuParser();

            hp.ParseHaiku("happy purple frog/eating bugs in the marshes/get indigestion");

            Assert.That(hp.HaikuLine.Sentence1.Key == "happy purple frog");
            Assert.That(hp.HaikuLine.Sentence2.Key == "eating bugs in the marshes");
            Assert.That(hp.HaikuLine.Sentence3.Key == "get indigestion");
        }
        public void When_valid_haiku_parsed_syllables_are_as_expected2()
        {
            HaikuParser hp = new HaikuParser();

            hp.ParseHaiku("computer programs/the bugs try to eat my code/i will not let them");

            Assert.That(hp.HaikuLine.Sentence1.Value == 5);
            Assert.That(hp.HaikuLine.Sentence2.Value == 8);
            Assert.That(hp.HaikuLine.Sentence3.Value == 5);
        }
        public void CountLines_WithValidString_ReturnsCorrectCount(string stringToCount, int expected)
        {
            HaikuParser haikuParser = GetNewHaikuParser(stringToCount);

            Assert.AreEqual(expected, haikuParser.CountLines());
        }
        public void When_valid_haiku_parsed_no_argument_exception_thrown()
        {
            HaikuParser hp = new HaikuParser();

            Assert.DoesNotThrow(() => hp.ParseHaiku("word1/word2/word3"));
        }
        public void When_invalid_haiku_parsed_argument_exception_thrown3()
        {
            HaikuParser hp = new HaikuParser();

            Assert.Throws <ArgumentException>(() => hp.ParseHaiku("word1/word2/word3/"));
        }
Exemplo n.º 10
0
        public void When_null_haiku_parsed_argument_exception_thrown()
        {
            HaikuParser hp = new HaikuParser();

            Assert.Throws <ArgumentException>(() => hp.ParseHaiku(null));
        }