示例#1
0
        public void TerminalAskTheFirstQuestion()
        {
            // Arrange
            Terminal term = new Terminal();

            // Act
            string actual_output = term.AskFirstQuestion();
            string expected_output = "What would you like for me to do?";

            // Assert
            Assert.AreEqual(expected_output, actual_output);
        }
示例#2
0
        public void TerminalFirstQuestionSadPathPrimeNumbers()
        {
            // Arrange
            Terminal term = new Terminal();

            // Act
            term.AskFirstQuestion();
            string first_input = "car";
            string actual_output = term.AcceptFirstAnswer(first_input);
            string expected_output = "Whoops!";

            // Assert
            Assert.AreEqual(expected_output, actual_output);
            Assert.AreEqual(0, term.Progress);
            Assert.IsNull(term.NumberFamily);
            Assert.AreEqual(0, term.Count);
        }
示例#3
0
        public void TerminalHappyPathPrimeNumbers()
        {
            // Arrange
            Terminal term = new Terminal();

            // Act
            term.AskFirstQuestion();
            string first_input = "prime";
            term.AcceptFirstAnswer(first_input); /* Create Prime class instance */
            string second_input = "20";
            string second_output = term.AcceptSecondAnswer(second_input);
            string expected_second_output = "Cool. I'm going to print 20 prime numbers";

            // Assert
            Assert.AreEqual(expected_second_output, second_output);
            Assert.AreEqual(2, term.Progress);
            Assert.AreEqual(first_input,term.NumberFamily);
            Assert.AreEqual(20, term.Count);
        }
示例#4
0
        public void TerminalSecondQuestionSadPathPrimeNumbers()
        {
            // Arrange
            Terminal term = new Terminal();

            // Act
            term.AskFirstQuestion();
            string first_input = "prime";
            term.AcceptFirstAnswer(first_input);
            string second_input = "2000";
            string second_output = term.AcceptSecondAnswer(second_input);
            string expected_second_output = "Whoops!";

            // Assert
            Assert.AreEqual(expected_second_output, second_output);
            Assert.AreEqual(1, term.Progress);
            Assert.AreEqual(first_input, term.NumberFamily);
            Assert.AreEqual(0,term.Count);
        }
示例#5
0
        public void TerminalInstantiatePrimeInstance()
        {
            // Arrange
            Terminal term = new Terminal();

            // Act
            term.AskFirstQuestion();
            string first_input = "prime";
            term.AcceptFirstAnswer(first_input);
            Integer actual_output = term.NumberFamilyFactory();

            // Assert
            Assert.IsInstanceOfType(actual_output, typeof(Prime));
        }