Removed assembly level fixtures

This commit is contained in:
kay.one 2011-11-13 10:16:31 -08:00
parent 72d0fc50ed
commit 207550176c
22 changed files with 43 additions and 51 deletions

View File

@ -1,11 +1,12 @@
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using Ninject; using Ninject;
using NzbDrone.Test.Common;
namespace NzbDrone.App.Test namespace NzbDrone.App.Test
{ {
[TestFixture] [TestFixture]
public class CentralDispatchTests public class CentralDispatchTests : TestBase
{ {
[Test] [Test]
public void Kernel_can_get_kernel() public void Kernel_can_get_kernel()

View File

@ -1,8 +0,0 @@
// ReSharper disable CheckNamespace
using NUnit.Framework;
using NzbDrone.Test.Common;
[SetUpFixture]
public class Fixtures : LoggingTest
{
}

View File

@ -1,22 +1,18 @@
using System; using System.Diagnostics;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text;
using AutoMoq; using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using FluentAssertions;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common; using NzbDrone.Common;
using NzbDrone.Common.Model; using NzbDrone.Common.Model;
using NzbDrone.Model;
using NzbDrone.Providers; using NzbDrone.Providers;
using NzbDrone.Test.Common;
namespace NzbDrone.App.Test namespace NzbDrone.App.Test
{ {
[TestFixture] [TestFixture]
public class MonitoringProviderTest public class MonitoringProviderTest : TestBase
{ {
[Test] [Test]

View File

@ -65,7 +65,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="CentralDispatchTests.cs" /> <Compile Include="CentralDispatchTests.cs" />
<Compile Include="Fixtures.cs" />
<Compile Include="RouterTest.cs" /> <Compile Include="RouterTest.cs" />
<Compile Include="MonitoringProviderTest.cs" /> <Compile Include="MonitoringProviderTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />

View File

@ -5,11 +5,12 @@ using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common; using NzbDrone.Common;
using NzbDrone.Model; using NzbDrone.Model;
using NzbDrone.Test.Common;
namespace NzbDrone.App.Test namespace NzbDrone.App.Test
{ {
[TestFixture] [TestFixture]
public class RouterTest public class RouterTest : TestBase
{ {
[TestCase(null, ApplicationMode.Console)] [TestCase(null, ApplicationMode.Console)]

View File

@ -4,11 +4,12 @@ using System.IO;
using System.Linq; using System.Linq;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Common.Test namespace NzbDrone.Common.Test
{ {
[TestFixture] [TestFixture]
public class DiskProviderTests public class DiskProviderTests : TestBase
{ {
DirectoryInfo BinFolder; DirectoryInfo BinFolder;
DirectoryInfo BinFolderCopy; DirectoryInfo BinFolderCopy;

View File

@ -4,11 +4,12 @@ using System;
using System.IO; using System.IO;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Common.Test namespace NzbDrone.Common.Test
{ {
[TestFixture] [TestFixture]
public class EnviromentProviderTest public class EnviromentProviderTest : TestBase
{ {
readonly EnviromentProvider enviromentProvider = new EnviromentProvider(); readonly EnviromentProvider enviromentProvider = new EnviromentProvider();

View File

@ -1,8 +0,0 @@
// ReSharper disable CheckNamespace
using NUnit.Framework;
using NzbDrone.Test.Common;
[SetUpFixture]
public class Fixtures : LoggingTest
{
}

View File

@ -65,7 +65,6 @@
<Compile Include="PathExtentionFixture.cs" /> <Compile Include="PathExtentionFixture.cs" />
<Compile Include="DiskProviderTests.cs" /> <Compile Include="DiskProviderTests.cs" />
<Compile Include="EnviromentProviderTest.cs" /> <Compile Include="EnviromentProviderTest.cs" />
<Compile Include="Fixtures.cs" />
<Compile Include="ProcessProviderTests.cs" /> <Compile Include="ProcessProviderTests.cs" />
<Compile Include="ServiceControllerTests.cs" /> <Compile Include="ServiceControllerTests.cs" />
<Compile Include="WebClientTests.cs" /> <Compile Include="WebClientTests.cs" />

View File

@ -2,11 +2,12 @@
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common; using NzbDrone.Common;
using NzbDrone.Test.Common;
namespace NzbDrone.App.Test namespace NzbDrone.App.Test
{ {
[TestFixture] [TestFixture]
public class PathExtentionFixture public class PathExtentionFixture : TestBase
{ {
private EnviromentProvider GetEnviromentProvider() private EnviromentProvider GetEnviromentProvider()

View File

@ -3,11 +3,12 @@ using System.Diagnostics;
using System.Linq; using System.Linq;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Common.Test namespace NzbDrone.Common.Test
{ {
[TestFixture] [TestFixture]
public class ProcessProviderTests public class ProcessProviderTests : TestBase
{ {
private const string DummyProccessName = "NzbDrone.Test.Dummy"; private const string DummyProccessName = "NzbDrone.Test.Dummy";
ProcessProvider _processProvider; ProcessProvider _processProvider;

View File

@ -3,11 +3,12 @@
using System.ServiceProcess; using System.ServiceProcess;
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Common.Test namespace NzbDrone.Common.Test
{ {
[TestFixture] [TestFixture]
public class ServiceControllerTests public class ServiceControllerTests:TestBase
{ {
private const string ALWAYS_INSTALLED_SERVICE = "SCardSvr"; //Smart Card 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"; //Smart Card
@ -74,7 +75,7 @@ namespace NzbDrone.Common.Test
} }
[Test] [Test]
[Timeout(10000)] //[Timeout(10000)]
public void Should_be_able_to_start_and_stop_service() public void Should_be_able_to_start_and_stop_service()
{ {
serviceProvider.GetService(ALWAYS_INSTALLED_SERVICE).Status serviceProvider.GetService(ALWAYS_INSTALLED_SERVICE).Status

View File

@ -1,11 +1,12 @@
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
using FluentAssertions; using FluentAssertions;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Common.Test namespace NzbDrone.Common.Test
{ {
[TestFixture] [TestFixture]
public class WebClientTests public class WebClientTests : TestBase
{ {
[Test] [Test]
public void DownloadString_should_be_able_to_download_jquery() public void DownloadString_should_be_able_to_download_jquery()

View File

@ -86,8 +86,12 @@ namespace NzbDrone.Common
public static void Reload() public static void Reload()
{ {
var sw = Stopwatch.StartNew();
LogManager.Configuration.Reload(); LogManager.Configuration.Reload();
LogManager.ReconfigExistingLoggers(); LogManager.ReconfigExistingLoggers();
sw.Stop();
Console.WriteLine("Reload: " + sw.Elapsed.TotalSeconds);
} }
} }
} }

View File

@ -116,16 +116,16 @@ namespace NzbDrone.Common
public virtual void Start(string serviceName) public virtual void Start(string serviceName)
{ {
Logger.Info("Starting {0} Service..."); Logger.Info("Starting {0} Service...", serviceName);
var service = GetService(serviceName); var service = GetService(serviceName);
if (service == null) if (service == null)
{ {
Logger.Warn("Unable to start '{0}' no service with that name exists.", serviceName); Logger.Warn("Unable to start '{0}' no service with that name exists.", serviceName);
} }
if (service.Status != ServiceControllerStatus.Paused || service.Status != ServiceControllerStatus.Stopped) if (service.Status != ServiceControllerStatus.Paused && service.Status != ServiceControllerStatus.Stopped)
{ {
Logger.Warn("Service is in a state that can't be started {0}", service.Status); Logger.Warn("Service is in a state that can't be started. Current status: {0}", service.Status);
} }
service.Start(); service.Start();
@ -135,7 +135,7 @@ namespace NzbDrone.Common
if (service.Status == ServiceControllerStatus.Running) if (service.Status == ServiceControllerStatus.Running)
{ {
Logger.Info("{0} has started successfully."); Logger.Info("{0} has started successfully.", serviceName);
} }
else else
{ {

View File

@ -105,7 +105,7 @@ namespace NzbDrone.Core.Test
public void TearDownBase() public void TearDownBase()
{ {
WebTimer.Stop(); WebTimer.Stop();
} }
} }
} }

View File

@ -39,6 +39,7 @@ namespace NzbDrone.Core
MigrationsHelper.Run(mainConnectionString, true); MigrationsHelper.Run(mainConnectionString, true);
LogConfiguration.RegisterDatabaseLogger(Kernel.Get<DatabaseTarget>()); LogConfiguration.RegisterDatabaseLogger(Kernel.Get<DatabaseTarget>());
LogConfiguration.Reload();
Kernel.Get<QualityProvider>().SetupDefaultProfiles(); Kernel.Get<QualityProvider>().SetupDefaultProfiles();
Kernel.Get<QualityTypeProvider>().SetupDefault(); Kernel.Get<QualityTypeProvider>().SetupDefault();

View File

@ -31,13 +31,18 @@ namespace NzbDrone.Core.Instrumentation
Common.LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Core.CentralDispatch"); Common.LogConfiguration.RegisterConsoleLogger(LogLevel.Info, "NzbDrone.Core.CentralDispatch");
LogManager.ConfigurationReloaded += ((s, e) => RegisterDatabaseLogger(_databaseTarget)); LogManager.ConfigurationReloaded += ((s, e) => RegisterDatabaseLogger(_databaseTarget));
Common.LogConfiguration.Reload();
} }
public static void RegisterDatabaseLogger(DatabaseTarget databaseTarget) public static void RegisterDatabaseLogger(DatabaseTarget databaseTarget)
{ {
LogManager.Configuration.AddTarget("DbLogger", databaseTarget); LogManager.Configuration.AddTarget("DbLogger", databaseTarget);
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, databaseTarget)); LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, databaseTarget));
Reload();
}
public static void Reload()
{
Common.LogConfiguration.Reload(); Common.LogConfiguration.Reload();
} }
} }

View File

@ -1,8 +0,0 @@
// ReSharper disable CheckNamespace
using NUnit.Framework;
using NzbDrone.Test.Common;
[SetUpFixture]
public class Fixtures : LoggingTest
{
}

View File

@ -48,6 +48,7 @@
<Reference Include="Moq"> <Reference Include="Moq">
<HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath> <HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
</Reference> </Reference>
<Reference Include="NLog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL" />
<Reference Include="nunit.framework"> <Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath> <HintPath>..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath>
</Reference> </Reference>
@ -66,7 +67,6 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Fixtures.cs" />
<Compile Include="UpdateProviderVerifyTest.cs" /> <Compile Include="UpdateProviderVerifyTest.cs" />
<Compile Include="UpdateProviderStartTest.cs" /> <Compile Include="UpdateProviderStartTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />

View File

@ -5,12 +5,13 @@ using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common; using NzbDrone.Common;
using NzbDrone.Common.Model; using NzbDrone.Common.Model;
using NzbDrone.Test.Common;
using NzbDrone.Update.Providers; using NzbDrone.Update.Providers;
namespace NzbDrone.Update.Test namespace NzbDrone.Update.Test
{ {
[TestFixture] [TestFixture]
class UpdateProviderStartTest class UpdateProviderStartTest : TestBase
{ {
AutoMoqer mocker = new AutoMoqer(); AutoMoqer mocker = new AutoMoqer();
@ -109,6 +110,8 @@ namespace NzbDrone.Update.Test
mocker.Resolve<UpdateProvider>().Start(TARGET_FOLDER); mocker.Resolve<UpdateProvider>().Start(TARGET_FOLDER);
ExceptionVerification.ExcpectedFatals(1);
mocker.VerifyAllMocks(); mocker.VerifyAllMocks();
} }

View File

@ -6,12 +6,13 @@ using FluentAssertions;
using Moq; using Moq;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Common; using NzbDrone.Common;
using NzbDrone.Test.Common;
using NzbDrone.Update.Providers; using NzbDrone.Update.Providers;
namespace NzbDrone.Update.Test namespace NzbDrone.Update.Test
{ {
[TestFixture] [TestFixture]
class UpdateProviderVerifyTest class UpdateProviderVerifyTest : TestBase
{ {
AutoMoqer mocker = new AutoMoqer(); AutoMoqer mocker = new AutoMoqer();