public void TestLimitDisabled() { var xmlSettings = new UserSettingsService(); xmlSettings.Initialize(); var logger = new Mock <ILogger>(); var mediator = new Mock <Mediator>(); var shutdownService = new Mock <IShutdownService>(); var limitHandler = new LimitHandler(mediator.Object, xmlSettings, logger.Object, shutdownService.Object); var app = new Aplication() { WinName = "test app" }; var limit = new AppLimit() { LimitReachedAction = LimitReachedAction.Warn, Application = app, ID = 1 }; xmlSettings.LimitsSettings.DontShowLimits.Add(limit.ID); limitHandler.Handle(limit); mediator.Verify(m => m.NotifyColleagues(MediatorMessages.APP_LIMIT_REACHED, limit), Times.Never()); }
public void TestShutdownAndWarn() { var xmlSettings = new UserSettingsService(); xmlSettings.Initialize(); var logger = new Mock <ILogger>(); var mediator = new Mock <Mediator>(); var shutdownService = new Mock <IShutdownService>(); var limitHandler = new LimitHandler(mediator.Object, xmlSettings, logger.Object, shutdownService.Object); var app = new Aplication() { WinName = "test app" }; var limit = new AppLimit() { LimitReachedAction = LimitReachedAction.WarnAndShutdown, Application = app }; limitHandler.Handle(limit); mediator.Verify(m => m.NotifyColleagues(MediatorMessages.APP_LIMIT_REACHED, limit), Times.Once()); shutdownService.Verify(s => s.Shutdown(app.WinName), Times.Once()); }