示例#1
0
        public void TestNonSatisfiedVerbosityWriteNotRecordLastMessage()
        {
            var mockInput       = new Mock <IInput>();
            var mockErrorOutput = new Mock <IOutput>();
            var mockOutput      = new Mock <IOutputConsole>();

            mockOutput.Setup((o) => o.Options)
            .Returns(OutputOptions.VerbosityNormal | OutputOptions.OutputPlain);

            mockOutput.Setup((o) => o.GetErrorOutput())
            .Returns(mockErrorOutput.Object);

            var ioConsole = new IOConsole(mockInput.Object, mockOutput.Object);

            ioConsole.WriteError("foo", false);
            ioConsole.WriteError("foo bar baz", true, Verbosities.Debug);
            ioConsole.OverwriteError("bar", false);

            mockErrorOutput.Verify((o) => o.Write("foo", false, OutputOptions.VerbosityNormal), Times.Once());
            mockErrorOutput.Verify((o) => o.Write("foo bar baz", true, OutputOptions.VerbosityDebug), Times.Once());
            mockErrorOutput.Verify((o) => o.Write("\x08\x08\x08", false, OutputOptions.VerbosityNormal), Times.Once());
            mockErrorOutput.Verify((o) => o.Write("bar", false, OutputOptions.VerbosityNormal), Times.Once());
        }