From fd8ad73476d0cb386a2251f3e38269e675c785c1 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Fri, 18 Jan 2013 21:14:12 -0800 Subject: [PATCH] fixed broken tests. --- .../ProviderTests/IndexerProviderTest.cs | 19 +++++++----- .../JobProviderTests/JobProviderFixture.cs | 29 ++----------------- .../ProviderTests/NewznabProviderTest.cs | 22 +++++++++----- .../ProviderTests/QualityTypeProviderTest.cs | 4 +-- NzbDrone.Core.Test/QualityProfileTest.cs | 3 +- NzbDrone.Core/CentralDispatch.cs | 2 +- .../PetaPoco/EpisodeSeasonRelator.cs | 4 +-- NzbDrone.Core/NzbDrone.Core.csproj | 1 - NzbDrone.Web/Web.config | 2 -- 9 files changed, 33 insertions(+), 53 deletions(-) diff --git a/NzbDrone.Core.Test/ProviderTests/IndexerProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/IndexerProviderTest.cs index 04502e7da..9a88fff58 100644 --- a/NzbDrone.Core.Test/ProviderTests/IndexerProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/IndexerProviderTest.cs @@ -28,9 +28,9 @@ namespace NzbDrone.Core.Test.ProviderTests Mocker.SetConstant(TestDbHelper.GetEmptyDatabase()); - //Act + Mocker.SetConstant>(new List { Mocker.Resolve() }); + var indexerProvider = Mocker.Resolve(); - indexerProvider.InitializeIndexers(new List { Mocker.Resolve() }); 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>(new List { Mocker.Resolve() }); + var indexerProvider = Mocker.Resolve(); - indexerProvider.InitializeIndexers(new List { Mocker.Resolve() }); + 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>(new List { Mocker.Resolve() }); + var indexerProvider = Mocker.Resolve(); - indexerProvider.InitializeIndexers(new List { Mocker.Resolve() }); + //Assert indexerProvider.All(); @@ -82,9 +84,10 @@ namespace NzbDrone.Core.Test.ProviderTests { Mocker.SetConstant(TestDbHelper.GetEmptyDatabase()); - //Act + Mocker.SetConstant>(new List { Mocker.Resolve() }); + var indexerProvider = Mocker.Resolve(); - indexerProvider.InitializeIndexers(new List { Mocker.Resolve() }); + //Assert indexerProvider.All(); diff --git a/NzbDrone.Core.Test/ProviderTests/JobProviderTests/JobProviderFixture.cs b/NzbDrone.Core.Test/ProviderTests/JobProviderTests/JobProviderFixture.cs index e9d9dfea1..f9b605149 100644 --- a/NzbDrone.Core.Test/ProviderTests/JobProviderTests/JobProviderFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/JobProviderTests/JobProviderFixture.cs @@ -45,7 +45,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests private void ResetLastExecution() { var jobProvider = Mocker.Resolve(); - 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.Initialize(); + //Act jobProvider.QueueJob(typeof(FakeJob)); @@ -150,7 +149,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests Mocker.SetConstant(BaseFakeJobs); var jobProvider = Mocker.Resolve(); - 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.Initialize(); //Act jobProvider.QueueJob(typeof(BrokenJob)); @@ -193,7 +190,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests Mocker.SetConstant(fakeJobs); var jobProvider = Mocker.Resolve(); - jobProvider.Initialize(); //Act @@ -214,7 +210,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests Mocker.SetConstant(BaseFakeJobs); var jobProvider = Mocker.Resolve(); - jobProvider.Initialize(); jobProvider.QueueJob(typeof(SlowJob)); @@ -243,8 +238,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests var jobProvider = Mocker.Resolve(); - //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.Initialize(); } var Mocker2 = new AutoMoqer(); @@ -294,10 +286,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests Db.Insert(deletedJob); var jobProvider = Mocker.Resolve(); - //Act - jobProvider.Initialize(); - - //Assert var registeredJobs = Db.Fetch(); 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(); - //Act - jobProvider.Initialize(); - - //Assert var registeredJobs = Db.Fetch(); 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(); + Mocker.Resolve(); - //Act - jobProvider.Initialize(); //Assert var registeredJobs = Db.Fetch(); @@ -367,7 +349,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests Mocker.SetConstant(fakeJobs); var jobProvider = Mocker.Resolve(); - 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.Initialize(); jobProvider.QueueScheduled(); WaitForQueue(); @@ -398,7 +378,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests //Act var jobProvider = Mocker.Resolve(); - jobProvider.Initialize(); ResetLastExecution(); jobProvider.QueueJob(typeof(FakeJob), 10); @@ -416,7 +395,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests //Act var jobProvider = Mocker.Resolve(); - jobProvider.Initialize(); jobProvider.QueueJob(typeof(FakeJob), 10); WaitForQueue(); @@ -440,7 +418,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests //Act var jobProvider = Mocker.Resolve(); - jobProvider.Initialize(); jobProvider.Queue.Add(stuckQueueItem); WaitForQueue(); @@ -481,7 +458,6 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests var jobProvider = Mocker.Resolve(); - 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.Initialize(); ResetLastExecution(); jobProvider.QueueScheduled(); diff --git a/NzbDrone.Core.Test/ProviderTests/NewznabProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/NewznabProviderTest.cs index 86a9d0f29..e53d4daa4 100644 --- a/NzbDrone.Core.Test/ProviderTests/NewznabProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/NewznabProviderTest.cs @@ -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>(definitions); + //Act - Mocker.Resolve().InitializeNewznabIndexers(definitions); + Mocker.Resolve(); //Assert var result = db.Fetch(); @@ -243,8 +242,11 @@ namespace NzbDrone.Core.Test.ProviderTests db.Insert(definitions[0]); db.Insert(definitions[2]); + Mocker.SetConstant>(definitions); + + //Act - Mocker.Resolve().InitializeNewznabIndexers(definitions); + Mocker.Resolve(); //Assert var result = db.Fetch(); @@ -267,8 +269,10 @@ namespace NzbDrone.Core.Test.ProviderTests db.Insert(definition); + Mocker.SetConstant>(new List { definition }); + //Act - Mocker.Resolve().InitializeNewznabIndexers(new List{ definition }); + Mocker.Resolve(); //Assert var result = db.Fetch(); @@ -291,8 +295,12 @@ namespace NzbDrone.Core.Test.ProviderTests db.Insert(definition); db.Insert(definition); + + Mocker.SetConstant>(new List { definition }); + + //Act - Mocker.Resolve().InitializeNewznabIndexers(new List { definition }); + Mocker.Resolve(); //Assert var result = db.Fetch(); diff --git a/NzbDrone.Core.Test/ProviderTests/QualityTypeProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/QualityTypeProviderTest.cs index 5632d95d3..6242c10cb 100644 --- a/NzbDrone.Core.Test/ProviderTests/QualityTypeProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/QualityTypeProviderTest.cs @@ -24,7 +24,7 @@ namespace NzbDrone.Core.Test.ProviderTests Mocker.SetConstant(db); //Act - Mocker.Resolve().SetupDefault(); + Mocker.Resolve(); //Assert var types = Mocker.Resolve().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().SetupDefault(); + Mocker.Resolve(); //Assert var types = Mocker.Resolve().All(); diff --git a/NzbDrone.Core.Test/QualityProfileTest.cs b/NzbDrone.Core.Test/QualityProfileTest.cs index d0bc8c912..f38ff96be 100644 --- a/NzbDrone.Core.Test/QualityProfileTest.cs +++ b/NzbDrone.Core.Test/QualityProfileTest.cs @@ -135,7 +135,7 @@ namespace NzbDrone.Core.Test Mocker.SetConstant(db); //Act - Mocker.Resolve().SetupDefaultProfiles(); + Mocker.Resolve(); //Assert var profiles = Mocker.Resolve().All(); @@ -159,7 +159,6 @@ namespace NzbDrone.Core.Test //Act Mocker.Resolve().Add(fakeProfile); - Mocker.Resolve().SetupDefaultProfiles(); //Assert var profiles = Mocker.Resolve().All(); diff --git a/NzbDrone.Core/CentralDispatch.cs b/NzbDrone.Core/CentralDispatch.cs index 6627cc4e3..ddae141ab 100644 --- a/NzbDrone.Core/CentralDispatch.cs +++ b/NzbDrone.Core/CentralDispatch.cs @@ -27,7 +27,7 @@ namespace NzbDrone.Core } - private void RegisterReporting(IContainer container) + private void RegisterReporting(IComponentContext container) { EnvironmentProvider.UGuid = container.Resolve().UGuid; ReportingService.RestProvider = container.Resolve(); diff --git a/NzbDrone.Core/Datastore/PetaPoco/EpisodeSeasonRelator.cs b/NzbDrone.Core/Datastore/PetaPoco/EpisodeSeasonRelator.cs index 42ca1dc8d..ddad384e7 100644 --- a/NzbDrone.Core/Datastore/PetaPoco/EpisodeSeasonRelator.cs +++ b/NzbDrone.Core/Datastore/PetaPoco/EpisodeSeasonRelator.cs @@ -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 diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index 63e862f90..aac7024fb 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -614,7 +614,6 @@ - diff --git a/NzbDrone.Web/Web.config b/NzbDrone.Web/Web.config index da5571e02..8d486ad60 100644 --- a/NzbDrone.Web/Web.config +++ b/NzbDrone.Web/Web.config @@ -33,7 +33,6 @@ - @@ -50,7 +49,6 @@ -