fixed broken tests.

pull/3113/head
kay.one 12 years ago
parent c184595935
commit fd8ad73476

@ -28,9 +28,9 @@ namespace NzbDrone.Core.Test.ProviderTests
Mocker.SetConstant(TestDbHelper.GetEmptyDatabase());
//Act
Mocker.SetConstant<IEnumerable<IndexerBase>>(new List<IndexerBase> { Mocker.Resolve<MockIndexer>() });
var indexerProvider = Mocker.Resolve<IndexerProvider>();
indexerProvider.InitializeIndexers(new List<IndexerBase> { Mocker.Resolve<MockIndexer>() });
var settings = indexerProvider.GetSettings(typeof(MockIndexer));
settings.Enable = true;
indexerProvider.SaveSettings(settings);
@ -48,9 +48,10 @@ namespace NzbDrone.Core.Test.ProviderTests
{
Mocker.SetConstant(TestDbHelper.GetEmptyDatabase());
//Act
Mocker.SetConstant<IEnumerable<IndexerBase>>(new List<IndexerBase> { Mocker.Resolve<MockIndexer>() });
var indexerProvider = Mocker.Resolve<IndexerProvider>();
indexerProvider.InitializeIndexers(new List<IndexerBase> { Mocker.Resolve<MockIndexer>() });
var settings = indexerProvider.GetSettings(typeof(MockIndexer));
settings.Enable = false;
indexerProvider.SaveSettings(settings);
@ -66,9 +67,10 @@ namespace NzbDrone.Core.Test.ProviderTests
{
Mocker.SetConstant(TestDbHelper.GetEmptyDatabase());
//Act
Mocker.SetConstant<IEnumerable<IndexerBase>>(new List<IndexerBase> { Mocker.Resolve<DefaultEnabledIndexer>() });
var indexerProvider = Mocker.Resolve<IndexerProvider>();
indexerProvider.InitializeIndexers(new List<IndexerBase> { Mocker.Resolve<DefaultEnabledIndexer>() });
//Assert
indexerProvider.All();
@ -82,9 +84,10 @@ namespace NzbDrone.Core.Test.ProviderTests
{
Mocker.SetConstant(TestDbHelper.GetEmptyDatabase());
//Act
Mocker.SetConstant<IEnumerable<IndexerBase>>(new List<IndexerBase> { Mocker.Resolve<MockIndexer>() });
var indexerProvider = Mocker.Resolve<IndexerProvider>();
indexerProvider.InitializeIndexers(new List<IndexerBase> { Mocker.Resolve<MockIndexer>() });
//Assert
indexerProvider.All();

@ -45,7 +45,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
private void ResetLastExecution()
{
var jobProvider = Mocker.Resolve<JobProvider>();
jobProvider.Initialize();
var jobs = jobProvider.All();
foreach (var jobDefinition in jobs)
@ -130,7 +129,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
Mocker.SetConstant(BaseFakeJobs);
var jobProvider = Mocker.Resolve<JobProvider>();
jobProvider.Initialize();
//Act
jobProvider.QueueJob(typeof(FakeJob));
@ -150,7 +149,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
Mocker.SetConstant(BaseFakeJobs);
var jobProvider = Mocker.Resolve<JobProvider>();
jobProvider.Initialize();
jobProvider.QueueJob(typeof(SlowJob), 1);
jobProvider.QueueJob(typeof(SlowJob), 2);
jobProvider.QueueJob(typeof(SlowJob), 3);
@ -171,7 +169,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
Mocker.SetConstant(BaseFakeJobs);
var jobProvider = Mocker.Resolve<JobProvider>();
jobProvider.Initialize();
//Act
jobProvider.QueueJob(typeof(BrokenJob));
@ -193,7 +190,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
Mocker.SetConstant(fakeJobs);
var jobProvider = Mocker.Resolve<JobProvider>();
jobProvider.Initialize();
//Act
@ -214,7 +210,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
Mocker.SetConstant(BaseFakeJobs);
var jobProvider = Mocker.Resolve<JobProvider>();
jobProvider.Initialize();
jobProvider.QueueJob(typeof(SlowJob));
@ -243,8 +238,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
var jobProvider = Mocker.Resolve<JobProvider>();
//Act
jobProvider.Initialize();
//assert
var timers = jobProvider.All();
@ -269,7 +262,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
Mocker.SetConstant(BaseFakeJobs);
var jobProvider = Mocker.Resolve<JobProvider>();
jobProvider.Initialize();
}
var Mocker2 = new AutoMoqer();
@ -294,10 +286,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
Db.Insert(deletedJob);
var jobProvider = Mocker.Resolve<JobProvider>();
//Act
jobProvider.Initialize();
//Assert
var registeredJobs = Db.Fetch<JobDefinition>();
registeredJobs.Should().HaveCount(1);
registeredJobs.Should().NotContain(c => c.TypeName == deletedJob.TypeName);
@ -316,10 +304,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
Db.Insert(deletedJob);
var jobProvider = Mocker.Resolve<JobProvider>();
//Act
jobProvider.Initialize();
//Assert
var registeredJobs = Db.Fetch<JobDefinition>();
registeredJobs.Should().HaveCount(1);
registeredJobs.Should().NotContain(c => c.TypeName == deletedJob.TypeName);
@ -343,10 +327,8 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
var id = Convert.ToInt32(Db.Insert(initialFakeJob));
var jobProvider = Mocker.Resolve<JobProvider>();
Mocker.Resolve<JobProvider>();
//Act
jobProvider.Initialize();
//Assert
var registeredJobs = Db.Fetch<JobDefinition>();
@ -367,7 +349,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
Mocker.SetConstant(fakeJobs);
var jobProvider = Mocker.Resolve<JobProvider>();
jobProvider.Initialize();
//Assert
jobProvider.All().Should().HaveCount(1);
@ -381,7 +362,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
Mocker.SetConstant(BaseFakeJobs);
var jobProvider = Mocker.Resolve<JobProvider>();
jobProvider.Initialize();
jobProvider.QueueScheduled();
WaitForQueue();
@ -398,7 +378,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
//Act
var jobProvider = Mocker.Resolve<JobProvider>();
jobProvider.Initialize();
ResetLastExecution();
jobProvider.QueueJob(typeof(FakeJob), 10);
@ -416,7 +395,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
//Act
var jobProvider = Mocker.Resolve<JobProvider>();
jobProvider.Initialize();
jobProvider.QueueJob(typeof(FakeJob), 10);
WaitForQueue();
@ -440,7 +418,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
//Act
var jobProvider = Mocker.Resolve<JobProvider>();
jobProvider.Initialize();
jobProvider.Queue.Add(stuckQueueItem);
WaitForQueue();
@ -481,7 +458,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
var jobProvider = Mocker.Resolve<JobProvider>();
jobProvider.Initialize();
jobProvider.QueueJob(typeof(string));
WaitForQueue();
@ -495,7 +471,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
Mocker.SetConstant(BaseFakeJobs);
var jobProvider = Mocker.Resolve<JobProvider>();
jobProvider.Initialize();
ResetLastExecution();
jobProvider.QueueScheduled();

@ -4,14 +4,11 @@ using System.Linq;
using System.Net.Sockets;
using FizzWare.NBuilder;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Test.Common;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.ProviderTests
{
@ -214,8 +211,10 @@ namespace NzbDrone.Core.Test.ProviderTests
var db = TestDbHelper.GetEmptyDatabase();
Mocker.SetConstant(db);
Mocker.SetConstant<IEnumerable<NewznabDefinition>>(definitions);
//Act
Mocker.Resolve<NewznabProvider>().InitializeNewznabIndexers(definitions);
Mocker.Resolve<NewznabProvider>();
//Assert
var result = db.Fetch<NewznabDefinition>();
@ -243,8 +242,11 @@ namespace NzbDrone.Core.Test.ProviderTests
db.Insert(definitions[0]);
db.Insert(definitions[2]);
Mocker.SetConstant<IEnumerable<NewznabDefinition>>(definitions);
//Act
Mocker.Resolve<NewznabProvider>().InitializeNewznabIndexers(definitions);
Mocker.Resolve<NewznabProvider>();
//Assert
var result = db.Fetch<NewznabDefinition>();
@ -267,8 +269,10 @@ namespace NzbDrone.Core.Test.ProviderTests
db.Insert(definition);
Mocker.SetConstant<IEnumerable<NewznabDefinition>>(new List<NewznabDefinition> { definition });
//Act
Mocker.Resolve<NewznabProvider>().InitializeNewznabIndexers(new List<NewznabDefinition>{ definition });
Mocker.Resolve<NewznabProvider>();
//Assert
var result = db.Fetch<NewznabDefinition>();
@ -291,8 +295,12 @@ namespace NzbDrone.Core.Test.ProviderTests
db.Insert(definition);
db.Insert(definition);
Mocker.SetConstant<IEnumerable<NewznabDefinition>>(new List<NewznabDefinition> { definition });
//Act
Mocker.Resolve<NewznabProvider>().InitializeNewznabIndexers(new List<NewznabDefinition> { definition });
Mocker.Resolve<NewznabProvider>();
//Assert
var result = db.Fetch<NewznabDefinition>();

@ -24,7 +24,7 @@ namespace NzbDrone.Core.Test.ProviderTests
Mocker.SetConstant(db);
//Act
Mocker.Resolve<QualityTypeProvider>().SetupDefault();
Mocker.Resolve<QualityTypeProvider>();
//Assert
var types = Mocker.Resolve<QualityTypeProvider>().All();
@ -52,7 +52,7 @@ namespace NzbDrone.Core.Test.ProviderTests
db.Insert(new QualityType { QualityTypeId = 1, Name = "SDTV", MinSize = 0, MaxSize = 100 });
//Act
Mocker.Resolve<QualityTypeProvider>().SetupDefault();
Mocker.Resolve<QualityTypeProvider>();
//Assert
var types = Mocker.Resolve<QualityTypeProvider>().All();

@ -135,7 +135,7 @@ namespace NzbDrone.Core.Test
Mocker.SetConstant(db);
//Act
Mocker.Resolve<QualityProvider>().SetupDefaultProfiles();
Mocker.Resolve<QualityProvider>();
//Assert
var profiles = Mocker.Resolve<QualityProvider>().All();
@ -159,7 +159,6 @@ namespace NzbDrone.Core.Test
//Act
Mocker.Resolve<QualityProvider>().Add(fakeProfile);
Mocker.Resolve<QualityProvider>().SetupDefaultProfiles();
//Assert
var profiles = Mocker.Resolve<QualityProvider>().All();

@ -27,7 +27,7 @@ namespace NzbDrone.Core
}
private void RegisterReporting(IContainer container)
private void RegisterReporting(IComponentContext container)
{
EnvironmentProvider.UGuid = container.Resolve<ConfigProvider>().UGuid;
ReportingService.RestProvider = container.Resolve<RestProvider>();

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NzbDrone.Core.Repository;
namespace NzbDrone.Core.Datastore.PetaPoco

@ -614,7 +614,6 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="ClassDiagram1.cd" />
<None Include="packages.config" />
<None Include="Properties\AnalysisRules.ruleset" />
</ItemGroup>

@ -33,7 +33,6 @@
<customErrors mode="Off" />
<httpHandlers>
<!--<add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*"/>-->
<add path="api*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" />
<add path="cassette.axd" verb="*" type="Cassette.Aspnet.CassetteHttpHandler, Cassette.Aspnet" />
</httpHandlers>
<httpModules>
@ -50,7 +49,6 @@
<remove name="MvcHttpHandler" />
<remove name="UrlRoutingHandler" />
<add name="MvcHttpHandler" preCondition="integratedMode" verb="" path=".mvc" type="System.Web.Mvc.MvcHttpHandler" />
<add path="api*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
<add name="CassetteHttpHandler" path="cassette.axd" preCondition="integratedMode" verb="*" allowPathInfo="true" type="Cassette.Aspnet.CassetteHttpHandler, Cassette.Aspnet" />
</handlers>
<directoryBrowse enabled="false" />

Loading…
Cancel
Save