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

@ -67,7 +67,7 @@
<Compile Include="DiskProviderTests.cs" />
<Compile Include="EnviromentProviderTest.cs" />
<Compile Include="ProcessProviderTests.cs" />
<Compile Include="ServiceControllerTests.cs" />
<Compile Include="ServiceProviderTests.cs" />
<Compile Include="WebClientTests.cs" />
</ItemGroup>
<ItemGroup>

View file

@ -8,10 +8,10 @@ using NzbDrone.Test.Common;
namespace NzbDrone.Common.Test
{
[TestFixture]
public class ServiceControllerTests:TestBase
public class ServiceProviderTests : TestBase
{
private const string ALWAYS_INSTALLED_SERVICE = "SCardSvr"; //Smart Card
private const string TEMP_SERVICE_NAME = "NzbDrone_Nunit"; //Smart Card
private const string TEMP_SERVICE_NAME = "NzbDrone_Nunit";
private ServiceProvider serviceProvider;
@ -91,5 +91,21 @@ namespace NzbDrone.Common.Test
serviceProvider.GetService(ALWAYS_INSTALLED_SERVICE).Status
.Should().Be(ServiceControllerStatus.Stopped);
}
[Test]
public void Should_log_warn_if_on_stop_if_service_is_already_stopped()
{
serviceProvider.GetService(ALWAYS_INSTALLED_SERVICE).Status
.Should().NotBe(ServiceControllerStatus.Running);
//Act
serviceProvider.Stop(ALWAYS_INSTALLED_SERVICE);
//Assert
serviceProvider.GetService(ALWAYS_INSTALLED_SERVICE).Status
.Should().Be(ServiceControllerStatus.Stopped);
ExceptionVerification.ExcpectedWarns(1);
}
}
}