1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-23 22:25:14 -04:00

Fixed: Automation/Integration/Unit Tests

This commit is contained in:
Qstick
2019-09-02 22:22:25 -04:00
parent 944f420270
commit 7f221c7834
123 changed files with 1384 additions and 1191 deletions
@@ -1,4 +1,5 @@
using System;
using System.Security.Principal;
using System.ServiceProcess;
using FluentAssertions;
using NUnit.Framework;
@@ -61,6 +62,10 @@ namespace NzbDrone.Common.Test
[Test]
public void Service_should_be_installed_and_then_uninstalled()
{
if (!IsAnAdministrator())
{
Assert.Inconclusive("Can't run test without Administrator rights");
}
Subject.ServiceExist(TEMP_SERVICE_NAME).Should().BeFalse("Service already installed");
Subject.Install(TEMP_SERVICE_NAME);
@@ -100,9 +105,13 @@ namespace NzbDrone.Common.Test
}
[Test]
[Ignore("Shit appveyor")]
public void should_throw_if_starting_a_running_serivce()
public void should_throw_if_starting_a_running_service()
{
if (!IsAnAdministrator())
{
Assert.Inconclusive("Can't run test without Administrator rights");
}
Subject.GetService(ALWAYS_INSTALLED_SERVICE).Status
.Should().NotBe(ServiceControllerStatus.Running);
@@ -128,5 +137,10 @@ namespace NzbDrone.Common.Test
ExceptionVerification.ExpectedWarns(1);
}
private static bool IsAnAdministrator()
{
var principal = new WindowsPrincipal(WindowsIdentity.GetCurrent());
return principal.IsInRole(WindowsBuiltInRole.Administrator);
}
}
}
}