Beispiel #1
0
 void runtimeLogController_LogMessage(object sender, RuntimeLogEventArgs e)
 {
     SyncContext.Post(delegate
     {
         AppendTextLine(e.Message, e.Color);
     }, this);
 }
        public void LogMessage_should_bubble_up_from_logger()
        {
            var optionsController    = MockRepository.GenerateStub <IOptionsController>();
            var runtimeLogController = new RuntimeLogController(optionsController);
            var runtimeLogger        = MockRepository.GenerateStub <IRuntimeLogger>();

            runtimeLogController.SetLogger(runtimeLogger);
            bool logMessageFlag = false;
            var  eventArgs      = new RuntimeLogEventArgs("message", Color.Red);

            runtimeLogController.LogMessage += (sender, e) =>
            {
                Assert.AreEqual(eventArgs, e);
                logMessageFlag = true;
            };

            runtimeLogger.Raise(rl => rl.LogMessage += null, runtimeLogger, eventArgs);
            Assert.AreEqual(true, logMessageFlag);
        }