Fixed an upgrade/service bug where it would try to stop an already stopped service.

This commit is contained in:
kay.one 2011-11-14 18:38:15 -08:00
commit e35a4bf8ac
6 changed files with 54 additions and 17 deletions

View file

@ -51,9 +51,10 @@ namespace NzbDrone.Update.Test
}
[Test]
public void should_stop_nzbdrone_service_if_installed()
public void should_stop_nzbdrone_service_if_installed_and_running()
{
WithInstalledService();
WithServiceRunning(true);
//Act
Mocker.Resolve<UpdateProvider>().Start(TARGET_FOLDER);
@ -62,6 +63,19 @@ namespace NzbDrone.Update.Test
Mocker.GetMock<ServiceProvider>().Verify(c => c.Stop(ServiceProvider.NZBDRONE_SERVICE_NAME), Times.Once());
}
[Test]
public void should_not_stop_nzbdrone_service_if_installed_but_not_running()
{
WithInstalledService();
WithServiceRunning(false);
//Act
Mocker.Resolve<UpdateProvider>().Start(TARGET_FOLDER);
//Assert
Mocker.GetMock<ServiceProvider>().Verify(c => c.Stop(ServiceProvider.NZBDRONE_SERVICE_NAME), Times.Never());
}
[Test]
public void should_not_stop_nzbdrone_service_if_service_isnt_installed()
{