From ea77428b1cfbe5c57c98773b1079c51ecef65007 Mon Sep 17 00:00:00 2001 From: markus101 Date: Sat, 29 Jan 2011 12:03:47 -0800 Subject: [PATCH] Fixed unit tests. --- NzbDrone.Core.Test/HistoryProviderTest.cs | 17 +++++++++-------- NzbDrone.Core.Test/IndexerProviderTest.cs | 22 +++++++++++----------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/NzbDrone.Core.Test/HistoryProviderTest.cs b/NzbDrone.Core.Test/HistoryProviderTest.cs index 3ba755152..1be65c50c 100644 --- a/NzbDrone.Core.Test/HistoryProviderTest.cs +++ b/NzbDrone.Core.Test/HistoryProviderTest.cs @@ -8,6 +8,7 @@ using MbUnit.Framework.ContractVerifiers; using Moq; using NzbDrone.Core.Providers; using NzbDrone.Core.Repository; +using NzbDrone.Core.Repository.Quality; using SubSonic.Repository; namespace NzbDrone.Core.Test @@ -19,7 +20,7 @@ namespace NzbDrone.Core.Test public void AllItems() { //Setup - var indexer = new Indexer {Enabled = true, Name = "NzbMatrix", Order = 1, RssUrl = "http://www.nzbmatrix.com"}; + var indexer = new Indexer {Enabled = true, IndexerName = "NzbMatrix", Order = 1, RssUrl = "http://www.nzbmatrix.com"}; var series = new Series { SeriesId = 5656, @@ -47,7 +48,7 @@ namespace NzbDrone.Core.Test var list = new List(); list.Add(new History { - Id = new int(), + HistoryId = new int(), Date = DateTime.Now, IsProper = false, Quality = 1, @@ -73,7 +74,7 @@ namespace NzbDrone.Core.Test { //Todo: This test fails... Moq Setup doesn't return the expected value //Setup - var indexer = new Indexer { Enabled = true, Name = "NzbMatrix", Order = 1, RssUrl = "http://www.nzbmatrix.com" }; + var indexer = new Indexer { Enabled = true, IndexerName = "NzbMatrix", Order = 1, RssUrl = "http://www.nzbmatrix.com" }; var series = new Series { SeriesId = 5656, @@ -101,7 +102,7 @@ namespace NzbDrone.Core.Test var list = new List(); list.Add(new History { - Id = new int(), + HistoryId = new int(), Date = DateTime.Now, IsProper = false, Quality = 1, @@ -118,7 +119,7 @@ namespace NzbDrone.Core.Test var target = new HistoryProvider(repo.Object); //Act - var result = target.Exists(episode, false); + var result = target.Exists(episode.EpisodeId, QualityTypes.TV, false); //Assert Assert.AreEqual(result, true); @@ -130,7 +131,7 @@ namespace NzbDrone.Core.Test //Todo: This test fails... Moq Setup doesn't return the expected value //Setup - var indexer = new Indexer { Enabled = true, Name = "NzbMatrix", Order = 1, RssUrl = "http://www.nzbmatrix.com" }; + var indexer = new Indexer { Enabled = true, IndexerName = "NzbMatrix", Order = 1, RssUrl = "http://www.nzbmatrix.com" }; var series = new Series { SeriesId = 5656, @@ -158,7 +159,7 @@ namespace NzbDrone.Core.Test var list = new List(); list.Add(new History { - Id = new int(), + HistoryId = new int(), Date = DateTime.Now, IsProper = false, Quality = 1, @@ -173,7 +174,7 @@ namespace NzbDrone.Core.Test var target = new HistoryProvider(repo.Object); //Act - var result = target.Exists(episode, true); + var result = target.Exists(episode.EpisodeId, QualityTypes.TV, true); //Assert Assert.AreEqual(result, false); diff --git a/NzbDrone.Core.Test/IndexerProviderTest.cs b/NzbDrone.Core.Test/IndexerProviderTest.cs index 6b4640e45..ba2e693d2 100644 --- a/NzbDrone.Core.Test/IndexerProviderTest.cs +++ b/NzbDrone.Core.Test/IndexerProviderTest.cs @@ -24,10 +24,10 @@ namespace NzbDrone.Core.Test //Setup var list = new List(); - list.Add(new Indexer{Name = "Test1", RssUrl = "http://www.test1.com/rss.php", Enabled = true, Order = 1}); - list.Add(new Indexer{Name = "Test2", RssUrl = "http://www.test2.com/rss.php", Enabled = false, Order = 4}); - list.Add(new Indexer{Name = "Test3", RssUrl = "http://www.test3.com/rss.php", Enabled = true, Order = 3}); - list.Add(new Indexer{Name = "Test4", RssUrl = "http://www.test4.com/rss.php", Enabled = false, Order = 2}); + list.Add(new Indexer { IndexerName = "Test1", RssUrl = "http://www.test1.com/rss.php", Enabled = true, Order = 1 }); + list.Add(new Indexer { IndexerName = "Test2", RssUrl = "http://www.test2.com/rss.php", Enabled = false, Order = 4 }); + list.Add(new Indexer { IndexerName = "Test3", RssUrl = "http://www.test3.com/rss.php", Enabled = true, Order = 3 }); + list.Add(new Indexer { IndexerName = "Test4", RssUrl = "http://www.test4.com/rss.php", Enabled = false, Order = 2 }); var repo = new Mock(); repo.Setup(r => r.All()).Returns(list.AsQueryable()); @@ -39,7 +39,7 @@ namespace NzbDrone.Core.Test //Assert - Assert.AreEqual(result.Last().Name, "Test2"); + Assert.AreEqual(result.Last().IndexerName, "Test2"); } [Test] @@ -51,10 +51,10 @@ namespace NzbDrone.Core.Test //Setup var list = new List(); - list.Add(new Indexer { Name = "Test1", RssUrl = "http://www.test1.com/rss.php", Enabled = true, Order = 1 }); - list.Add(new Indexer { Name = "Test2", RssUrl = "http://www.test2.com/rss.php", Enabled = false, Order = 4 }); - list.Add(new Indexer { Name = "Test3", RssUrl = "http://www.test3.com/rss.php", Enabled = true, Order = 3 }); - list.Add(new Indexer { Name = "Test4", RssUrl = "http://www.test4.com/rss.php", Enabled = false, Order = 2 }); + list.Add(new Indexer { IndexerName = "Test1", RssUrl = "http://www.test1.com/rss.php", Enabled = true, Order = 1 }); + list.Add(new Indexer { IndexerName = "Test2", RssUrl = "http://www.test2.com/rss.php", Enabled = false, Order = 4 }); + list.Add(new Indexer { IndexerName = "Test3", RssUrl = "http://www.test3.com/rss.php", Enabled = true, Order = 3 }); + list.Add(new Indexer { IndexerName = "Test4", RssUrl = "http://www.test4.com/rss.php", Enabled = false, Order = 2 }); var repo = new Mock(); repo.Setup(r => r.All()).Returns(list.AsQueryable()); @@ -65,8 +65,8 @@ namespace NzbDrone.Core.Test var result = target.EnabledIndexers(); //Assert - Assert.AreEqual(result.First().Name, "Test1"); - Assert.AreEqual(result.Last().Name, "Test3"); + Assert.AreEqual(result.First().IndexerName, "Test1"); + Assert.AreEqual(result.Last().IndexerName, "Test3"); } } }