Inheritance: System.IO.StringWriter
Beispiel #1
0
        private void InitializeConsoleRedirect()
        {
            var consoleLogging = new ConsoleLogging();
            _consoleRedirector = new ConsoleRedirector();
            _consoleRedirector.Logging = consoleLogging;
            _consoleTraceListener = new ConsoleTraceListener();
            _consoleTraceListener.Logging = consoleLogging;

            // Set console outputs (this will redirect Console.Write* output to the cryengine console)
            Console.SetOut(_consoleRedirector);
            Console.SetError(_consoleRedirector);

            // Add our trace listener (this will redirect Trace.* output to the cryengine console)
            Trace.Listeners.Add(_consoleTraceListener);
        }
        public void Log_SimpleMessage_Success()
        {
            string msg = "Hello log!";

            var mocks = new MockRepository();
            var logging = mocks.StrictMock<ILogging>();
            logging.Log(msg);

            mocks.ReplayAll();

            var redirector = new ConsoleRedirector();
            redirector.Logging = logging;
            redirector.WriteLine(msg);

            mocks.VerifyAll();
        }
        public void Log_SimpleMessage_Success()
        {
            string warningMessage = "Warning message!";
            string informationMessage = "Information message";
            string errorMessage = "Error message";

            var mocks = new MockRepository();
            var logging = mocks.StrictMock<ILogging>();

            mocks.ReplayAll();

            var redirector = new ConsoleRedirector();
            redirector.Logging = logging;
            redirector.WriteLine(warningMessage);

            mocks.VerifyAll();
        }