public void start_not_running_service_during_service_check() { var service = Substitute.For <IApplicationService, IGuardedService>(); var locator = Substitute.For <IContainer>(); locator.ResolveAll <IApplicationService>().Returns(new[] { service }); var settingsRepos = Substitute.For <ISettingsRepository>(); settingsRepos.IsEnabled(Arg.Any <Type>()).Returns(true); var sut = new ApplicationServiceManager(locator); sut.Settings = settingsRepos; sut.CheckServices(); service.Received().Start(); }
public void do_not_stop_running_service_if_its_enabled() { var service = Substitute.For <IApplicationService, IGuardedService>(); var locator = Substitute.For <IContainer>(); locator.ResolveAll <IApplicationService>().Returns(new[] { service }); var settingsRepos = Substitute.For <ISettingsRepository>(); settingsRepos.IsEnabled(Arg.Any <Type>()).Returns(true); ((IGuardedService)service).IsRunning.Returns(true); var sut = new ApplicationServiceManager(locator); sut.Settings = settingsRepos; sut.CheckServices(); service.DidNotReceive().Stop(); }