public void Setting_MinLogSeverity_should_save_options() { var optionsController = MockRepository.GenerateStub <IOptionsController>(); var runtimeLogController = new RuntimeLogController(optionsController); var runtimeLogger = MockRepository.GenerateStub <IRuntimeLogger>(); runtimeLogController.SetLogger(runtimeLogger); runtimeLogController.MinLogSeverity = LogSeverity.Important; Assert.AreEqual(LogSeverity.Important, optionsController.MinLogSeverity); optionsController.AssertWasCalled(oc => oc.Save()); }
public void MinLogSeverity_should_be_restored_from_options() { var optionsController = MockRepository.GenerateStub <IOptionsController>(); optionsController.MinLogSeverity = LogSeverity.Info; var runtimeLogController = new RuntimeLogController(optionsController); var runtimeLogger = MockRepository.GenerateStub <IRuntimeLogger>(); runtimeLogController.SetLogger(runtimeLogger); Assert.AreEqual(LogSeverity.Info, runtimeLogController.MinLogSeverity); }
public void MinLogSeverity_should_come_from_logger() { var optionsController = MockRepository.GenerateStub <IOptionsController>(); var runtimeLogController = new RuntimeLogController(optionsController); var runtimeLogger = MockRepository.GenerateStub <IRuntimeLogger>(); runtimeLogController.SetLogger(runtimeLogger); runtimeLogger.MinLogSeverity = LogSeverity.Error; Assert.AreEqual(LogSeverity.Error, runtimeLogController.MinLogSeverity); runtimeLogController.MinLogSeverity = LogSeverity.Important; Assert.AreEqual(LogSeverity.Important, runtimeLogger.MinLogSeverity); }
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); }