mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-16 15:29:40 +02:00
Fixed unit tests.
This commit is contained in:
parent
da979639ba
commit
ea77428b1c
@ -8,6 +8,7 @@
|
|||||||
using Moq;
|
using Moq;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
|
using NzbDrone.Core.Repository.Quality;
|
||||||
using SubSonic.Repository;
|
using SubSonic.Repository;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test
|
namespace NzbDrone.Core.Test
|
||||||
@ -19,7 +20,7 @@ public class HistoryProviderTest
|
|||||||
public void AllItems()
|
public void AllItems()
|
||||||
{
|
{
|
||||||
//Setup
|
//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
|
var series = new Series
|
||||||
{
|
{
|
||||||
SeriesId = 5656,
|
SeriesId = 5656,
|
||||||
@ -47,7 +48,7 @@ public void AllItems()
|
|||||||
var list = new List<History>();
|
var list = new List<History>();
|
||||||
list.Add(new History
|
list.Add(new History
|
||||||
{
|
{
|
||||||
Id = new int(),
|
HistoryId = new int(),
|
||||||
Date = DateTime.Now,
|
Date = DateTime.Now,
|
||||||
IsProper = false,
|
IsProper = false,
|
||||||
Quality = 1,
|
Quality = 1,
|
||||||
@ -73,7 +74,7 @@ public void Exists_True()
|
|||||||
{
|
{
|
||||||
//Todo: This test fails... Moq Setup doesn't return the expected value
|
//Todo: This test fails... Moq Setup doesn't return the expected value
|
||||||
//Setup
|
//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
|
var series = new Series
|
||||||
{
|
{
|
||||||
SeriesId = 5656,
|
SeriesId = 5656,
|
||||||
@ -101,7 +102,7 @@ public void Exists_True()
|
|||||||
var list = new List<History>();
|
var list = new List<History>();
|
||||||
list.Add(new History
|
list.Add(new History
|
||||||
{
|
{
|
||||||
Id = new int(),
|
HistoryId = new int(),
|
||||||
Date = DateTime.Now,
|
Date = DateTime.Now,
|
||||||
IsProper = false,
|
IsProper = false,
|
||||||
Quality = 1,
|
Quality = 1,
|
||||||
@ -118,7 +119,7 @@ public void Exists_True()
|
|||||||
var target = new HistoryProvider(repo.Object);
|
var target = new HistoryProvider(repo.Object);
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
var result = target.Exists(episode, false);
|
var result = target.Exists(episode.EpisodeId, QualityTypes.TV, false);
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
Assert.AreEqual(result, true);
|
Assert.AreEqual(result, true);
|
||||||
@ -130,7 +131,7 @@ public void Exists_False()
|
|||||||
//Todo: This test fails... Moq Setup doesn't return the expected value
|
//Todo: This test fails... Moq Setup doesn't return the expected value
|
||||||
|
|
||||||
//Setup
|
//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
|
var series = new Series
|
||||||
{
|
{
|
||||||
SeriesId = 5656,
|
SeriesId = 5656,
|
||||||
@ -158,7 +159,7 @@ public void Exists_False()
|
|||||||
var list = new List<History>();
|
var list = new List<History>();
|
||||||
list.Add(new History
|
list.Add(new History
|
||||||
{
|
{
|
||||||
Id = new int(),
|
HistoryId = new int(),
|
||||||
Date = DateTime.Now,
|
Date = DateTime.Now,
|
||||||
IsProper = false,
|
IsProper = false,
|
||||||
Quality = 1,
|
Quality = 1,
|
||||||
@ -173,7 +174,7 @@ public void Exists_False()
|
|||||||
var target = new HistoryProvider(repo.Object);
|
var target = new HistoryProvider(repo.Object);
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
var result = target.Exists(episode, true);
|
var result = target.Exists(episode.EpisodeId, QualityTypes.TV, true);
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
Assert.AreEqual(result, false);
|
Assert.AreEqual(result, false);
|
||||||
|
@ -24,10 +24,10 @@ public void AllIndexers()
|
|||||||
|
|
||||||
//Setup
|
//Setup
|
||||||
var list = new List<Indexer>();
|
var list = new List<Indexer>();
|
||||||
list.Add(new Indexer{Name = "Test1", RssUrl = "http://www.test1.com/rss.php", Enabled = true, Order = 1});
|
list.Add(new Indexer { IndexerName = "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 { IndexerName = "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 { IndexerName = "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 = "Test4", RssUrl = "http://www.test4.com/rss.php", Enabled = false, Order = 2 });
|
||||||
|
|
||||||
var repo = new Mock<IRepository>();
|
var repo = new Mock<IRepository>();
|
||||||
repo.Setup(r => r.All<Indexer>()).Returns(list.AsQueryable());
|
repo.Setup(r => r.All<Indexer>()).Returns(list.AsQueryable());
|
||||||
@ -39,7 +39,7 @@ public void AllIndexers()
|
|||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
|
|
||||||
Assert.AreEqual(result.Last().Name, "Test2");
|
Assert.AreEqual(result.Last().IndexerName, "Test2");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -51,10 +51,10 @@ public void EnabledIndexers()
|
|||||||
|
|
||||||
//Setup
|
//Setup
|
||||||
var list = new List<Indexer>();
|
var list = new List<Indexer>();
|
||||||
list.Add(new Indexer { Name = "Test1", RssUrl = "http://www.test1.com/rss.php", Enabled = true, Order = 1 });
|
list.Add(new Indexer { IndexerName = "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 { IndexerName = "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 { IndexerName = "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 = "Test4", RssUrl = "http://www.test4.com/rss.php", Enabled = false, Order = 2 });
|
||||||
|
|
||||||
var repo = new Mock<IRepository>();
|
var repo = new Mock<IRepository>();
|
||||||
repo.Setup(r => r.All<Indexer>()).Returns(list.AsQueryable());
|
repo.Setup(r => r.All<Indexer>()).Returns(list.AsQueryable());
|
||||||
@ -65,8 +65,8 @@ public void EnabledIndexers()
|
|||||||
var result = target.EnabledIndexers();
|
var result = target.EnabledIndexers();
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
Assert.AreEqual(result.First().Name, "Test1");
|
Assert.AreEqual(result.First().IndexerName, "Test1");
|
||||||
Assert.AreEqual(result.Last().Name, "Test3");
|
Assert.AreEqual(result.Last().IndexerName, "Test3");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user