コード例 #1
0
        public void Init()
        {
            input  = new StringReader("Dummy");
            output = new StringWriter();

            verifier = ((userInput) => string.Empty);
        }
コード例 #2
0
        public void WithVerificationFailures_DisplaysErrorMessage()
        {
            // set up the error message to return
            var errorMessage = "There was an error!";

            verifier = (userInput) => (userInput == "TestString") ? string.Empty : errorMessage;
            input    = new StringReader("BadString\nTestString");

            var prompt = CreatePrompt();

            prompt.Execute();

            var actualOutput = new StringReader(output.ToString());

            actualOutput.ReadLine();             // skip past the prompt
            var line2 = actualOutput.ReadLine();

            Assert.AreEqual("There was an error!", line2);
        }