mirror of https://github.com/lidarr/Lidarr
Merge branch 'master' of git://github.com/kayone/NzbDrone
This commit is contained in:
commit
7d1f0d2c08
|
@ -70,7 +70,7 @@ namespace NzbDrone.Core.Test
|
|||
.With(e => e.AirDate = DateTime.Now.AddDays(offsetDays))
|
||||
.With(e => e.Ignored = ignored)
|
||||
.With(e => e.EpisodeFileId = 0)
|
||||
.With(e => e.GrabDate = DateTime.Now.AddDays(-1))
|
||||
.With(e => e.GrabDate = DateTime.Now.AddHours(22))
|
||||
.Build();
|
||||
|
||||
if (hasEpisodes)
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.ServiceModel.Syndication;
|
||||
using AutoMoq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Providers.Indexer;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
public class FluentTest : TestBase
|
||||
{
|
||||
[TestCase(null, "def", "def")]
|
||||
[TestCase("", "def", "def")]
|
||||
[TestCase("", 1, "1")]
|
||||
[TestCase(null, "", "")]
|
||||
[TestCase("actual", "def", "actual")]
|
||||
public void WithDefault_success(string actual, object defaultValue, string result)
|
||||
{
|
||||
actual.WithDefault(defaultValue).Should().Be(result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(ArgumentNullException))]
|
||||
public void WithDefault_Fail()
|
||||
{
|
||||
"test".WithDefault(null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -23,17 +23,6 @@ namespace NzbDrone.Core.Test.Framework
|
|||
get { return new[] { "c:\\tv\\the simpsons", "c:\\tv\\family guy", "c:\\tv\\southpark", "c:\\tv\\24" }; }
|
||||
}
|
||||
|
||||
public static ConfigProvider StandardConfig
|
||||
{
|
||||
get
|
||||
{
|
||||
var mock = new Mock<ConfigProvider>();
|
||||
mock.SetupGet(c => c.SeriesRoot).Returns("C:\\");
|
||||
return mock.Object;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static IDatabase GetEmptyDatabase(bool enableLogging = false, string fileName = "")
|
||||
{
|
||||
Console.WriteLine("Creating an empty PetaPoco database");
|
||||
|
@ -83,14 +72,5 @@ namespace NzbDrone.Core.Test.Framework
|
|||
.With(c => c.CleanTitle = Parser.NormalizeTitle(title))
|
||||
.Build();
|
||||
}
|
||||
|
||||
public static IList<Episode> GetFakeEpisodes(int seriesId)
|
||||
{
|
||||
var epNumber = new SequentialGenerator<int>();
|
||||
return Builder<Episode>.CreateListOfSize(10)
|
||||
.WhereAll().Have(c => c.SeriesId = seriesId)
|
||||
.WhereAll().Have(c => c.EpisodeNumber = epNumber.Generate())
|
||||
.Build();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -84,6 +84,7 @@
|
|||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="FluentTest.cs" />
|
||||
<Compile Include="LogProviderTest.cs" />
|
||||
<Compile Include="UpcomingEpisodesProviderTest.cs" />
|
||||
<Compile Include="MediaFileProvider_ImportNewDownloadTest.cs" />
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using AutoMoq;
|
||||
using FizzWare.NBuilder;
|
||||
|
@ -15,11 +14,9 @@ using PetaPoco;
|
|||
using TvdbLib.Data;
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace NzbDrone.Core.Test
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
public class SeriesProviderTest : TestBase
|
||||
{
|
||||
[Test]
|
||||
|
@ -130,10 +127,12 @@ namespace NzbDrone.Core.Test
|
|||
var db = MockLib.GetEmptyDatabase();
|
||||
mocker.SetConstant(db);
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.QualityProfileId = 1).Build();
|
||||
var fakeSeries = Builder<Series>.CreateNew()
|
||||
.With(c => c.QualityProfileId = 1)
|
||||
.Build();
|
||||
var fakeQuality = Builder<QualityProfile>.CreateNew().Build();
|
||||
|
||||
var id = db.Insert(fakeSeries);
|
||||
db.Insert(fakeSeries);
|
||||
db.Insert(fakeQuality);
|
||||
|
||||
//Act
|
||||
|
@ -141,9 +140,10 @@ namespace NzbDrone.Core.Test
|
|||
var series = mocker.Resolve<SeriesProvider>().GetSeries(1);
|
||||
|
||||
//Assert
|
||||
series.ShouldHave().AllPropertiesBut(s => s.QualityProfile, s => s.SeriesId);
|
||||
series.ShouldHave().AllPropertiesBut(s => s.QualityProfile, s => s.SeriesId).EqualTo(fakeSeries);
|
||||
series.QualityProfile.Should().NotBeNull();
|
||||
series.QualityProfile.ShouldHave().Properties(q => q.Name, q => q.SonicAllowed, q => q.Cutoff, q => q.AllowedString);
|
||||
series.QualityProfile.ShouldHave().Properties(q => q.Name, q => q.SonicAllowed, q => q.Cutoff, q => q.SonicAllowed).EqualTo(fakeQuality);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -239,8 +239,5 @@ namespace NzbDrone.Core.Test
|
|||
Assert.IsFalse(provider.IsMonitored(11));
|
||||
Assert.IsFalse(provider.IsMonitored(1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
} |