Fixed some more tests

pull/4/head
Mark McDowall 10 years ago
parent c03f4b8125
commit 42c17e885c

@ -84,6 +84,7 @@
<Compile Include="ProcessProviderTests.cs" /> <Compile Include="ProcessProviderTests.cs" />
<Compile Include="ReflectionExtensions.cs" /> <Compile Include="ReflectionExtensions.cs" />
<Compile Include="ReflectionTests\ReflectionExtensionFixture.cs" /> <Compile Include="ReflectionTests\ReflectionExtensionFixture.cs" />
<Compile Include="ServiceFactoryFixture.cs" />
<Compile Include="ServiceProviderTests.cs" /> <Compile Include="ServiceProviderTests.cs" />
<Compile Include="WebClientTests.cs" /> <Compile Include="WebClientTests.cs" />
</ItemGroup> </ItemGroup>

@ -1,14 +1,13 @@
using System.Linq; using System.Linq;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Core.Lifecycle; using NzbDrone.Core.Lifecycle;
using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Messaging.Events;
using NzbDrone.Host; using NzbDrone.Host;
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
namespace NzbDrone.Mono.Test namespace NzbDrone.Common.Test
{ {
[TestFixture] [TestFixture]
public class ServiceFactoryFixture : TestBase<ServiceFactory> public class ServiceFactoryFixture : TestBase<ServiceFactory>
@ -16,9 +15,10 @@ namespace NzbDrone.Mono.Test
[Test] [Test]
public void event_handlers_should_be_unique() public void event_handlers_should_be_unique()
{ {
MonoOnly(); var container = MainAppContainerBuilder.BuildContainer(new StartupContext());
container.Resolve<IAppFolderFactory>().Register();
Mocker.SetConstant(MainAppContainerBuilder.BuildContainer(new StartupContext()));
Mocker.SetConstant(container);
var handlers = Subject.BuildAll<IHandle<ApplicationShutdownRequested>>() var handlers = Subject.BuildAll<IHandle<ApplicationShutdownRequested>>()
.Select(c => c.GetType().FullName); .Select(c => c.GetType().FullName);

@ -4,7 +4,6 @@ using System.Data.SQLite;
using NLog.Common; using NLog.Common;
using NLog.Config; using NLog.Config;
using NLog; using NLog;
using NLog.Layouts;
using NLog.Targets; using NLog.Targets;
using NzbDrone.Common.Instrumentation; using NzbDrone.Common.Instrumentation;
using NzbDrone.Core.Datastore; using NzbDrone.Core.Datastore;
@ -78,12 +77,10 @@ namespace NzbDrone.Core.Instrumentation
log.Message += ": " + logEvent.Exception.Message; log.Message += ": " + logEvent.Exception.Message;
} }
log.Exception = logEvent.Exception.ToString(); log.Exception = logEvent.Exception.ToString();
log.ExceptionType = logEvent.Exception.GetType().ToString(); log.ExceptionType = logEvent.Exception.GetType().ToString();
} }
log.Level = logEvent.Level.Name; log.Level = logEvent.Level.Name;
var sqlCommand = new SQLiteCommand(INSERT_COMMAND, _connection); var sqlCommand = new SQLiteCommand(INSERT_COMMAND, _connection);

@ -74,7 +74,6 @@
<Compile Include="DiskProviderTests\DiskProviderFixture.cs" /> <Compile Include="DiskProviderTests\DiskProviderFixture.cs" />
<Compile Include="DiskProviderTests\FreeSpaceFixture.cs" /> <Compile Include="DiskProviderTests\FreeSpaceFixture.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ServiceFactoryFixture.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="app.config" /> <None Include="app.config" />

@ -55,6 +55,9 @@ namespace NzbDrone.Mono
catch (NotImplementedException) catch (NotImplementedException)
{ {
} }
catch (PlatformNotSupportedException)
{
}
} }
public override void SetPermissions(string path, string mask, string user, string group) public override void SetPermissions(string path, string mask, string user, string group)

@ -71,7 +71,6 @@
<Compile Include="DiskProviderTests\DiskProviderFixture.cs" /> <Compile Include="DiskProviderTests\DiskProviderFixture.cs" />
<Compile Include="DiskProviderTests\FreeSpaceFixture.cs" /> <Compile Include="DiskProviderTests\FreeSpaceFixture.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ServiceFactoryFixture.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\NzbDrone.Common\NzbDrone.Common.csproj"> <ProjectReference Include="..\NzbDrone.Common\NzbDrone.Common.csproj">

@ -1,31 +0,0 @@
using System.Linq;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Core.Lifecycle;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Host;
using NzbDrone.Test.Common;
namespace NzbDrone.Windows.Test
{
[TestFixture]
public class ServiceFactoryFixture : TestBase<ServiceFactory>
{
[SetUp]
public void setup()
{
Mocker.SetConstant(MainAppContainerBuilder.BuildContainer(new StartupContext()));
}
[Test]
public void event_handlers_should_be_unique()
{
var handlers = Subject.BuildAll<IHandle<ApplicationShutdownRequested>>()
.Select(c => c.GetType().FullName);
handlers.Should().OnlyHaveUniqueItems();
}
}
}
Loading…
Cancel
Save