commiting tests before teamcity demo

pull/6/head
kay.one 14 years ago
parent 702399318b
commit f97209d476

Binary file not shown.

@ -0,0 +1,15 @@
<Configuration>
<SnapshotDialog>
<InitialDirectory>D:\My Dropbox\Git\NzbDrone</InitialDirectory>
</SnapshotDialog>
<CoverageFilters>
<AllowFilters>
<Filter>
<ClassFilter>*</ClassFilter>
<FunctionFilter>*</FunctionFilter>
<ModuleFilter>*</ModuleFilter>
</Filter>
</AllowFilters>
<DenyFilters />
</CoverageFilters>
</Configuration>

@ -5,8 +5,8 @@ using System.Collections.Generic;
using System.Threading; using System.Threading;
using AutoMoq; using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using MbUnit.Framework;
using Moq; using Moq;
using NUnit.Framework;
using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Jobs; using NzbDrone.Core.Providers.Jobs;

@ -3,10 +3,8 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using AutoMoq; using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using Gallio.Framework;
using MbUnit.Framework;
using MbUnit.Framework.ContractVerifiers;
using Moq; using Moq;
using NUnit.Framework;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;

@ -2,12 +2,12 @@
using System; using System;
using System.Linq; using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq.Expressions; using System.Linq.Expressions;
using AutoMoq; using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using MbUnit.Framework; using FluentAssertions;
using Moq; using Moq;
using NUnit.Framework;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
@ -53,9 +53,9 @@ namespace NzbDrone.Core.Test
mocker.Resolve<EpisodeProvider>().RefreshEpisodeInfo(fakeSeries); mocker.Resolve<EpisodeProvider>().RefreshEpisodeInfo(fakeSeries);
//Assert //Assert
var actualCount = mocker.Resolve<EpisodeProvider>().GetEpisodeBySeries(seriesId); var actualCount = mocker.Resolve<EpisodeProvider>().GetEpisodeBySeries(seriesId).Count;
mocker.GetMock<TvDbProvider>().VerifyAll(); mocker.GetMock<TvDbProvider>().VerifyAll();
Assert.Count(episodeCount, actualCount); actualCount.Should().Be(episodeCount);
mocker.VerifyAllMocks(); mocker.VerifyAllMocks();
} }
@ -190,7 +190,7 @@ namespace NzbDrone.Core.Test
//Assert //Assert
mocker.VerifyAllMocks(); mocker.VerifyAllMocks();
Assert.Count(1, repo.All<Episode>()); repo.All<Episode>().Should().HaveCount(1);
} }
[Test] [Test]
@ -214,7 +214,7 @@ namespace NzbDrone.Core.Test
.With(c => c.SeasonNumber = 4) .With(c => c.SeasonNumber = 4)
.With(c => c.EpisodeNumber = 15) .With(c => c.EpisodeNumber = 15)
.Build(); .Build();
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build(); var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
@ -234,7 +234,7 @@ namespace NzbDrone.Core.Test
//Assert //Assert
mocker.VerifyAllMocks(); mocker.VerifyAllMocks();
Assert.Count(1, repo.All<Episode>()); repo.All<Episode>().Should().HaveCount(1);
} }
@ -283,9 +283,10 @@ namespace NzbDrone.Core.Test
e => e.Where(g => g.EpisodeFileId == 69).Count() == faketvDbResponse.Episodes.Count)), e => e.Where(g => g.EpisodeFileId == 69).Count() == faketvDbResponse.Episodes.Count)),
Times.Once()); Times.Once());
Assert.Count(faketvDbResponse.Episodes.Count, updatedEpisodes);
Assert.ForAll(updatedEpisodes, c => Assert.AreEqual(99, c.EpisodeId)); updatedEpisodes.Should().HaveSameCount(faketvDbResponse.Episodes);
Assert.ForAll(updatedEpisodes, c => Assert.AreEqual(69, c.EpisodeFileId)); updatedEpisodes.Should().OnlyContain(c => c.EpisodeId == 99);
updatedEpisodes.Should().OnlyContain(c => c.EpisodeFileId == 69);
} }
@ -307,7 +308,7 @@ namespace NzbDrone.Core.Test
//assert //assert
var episodes = episodeProvider.GetEpisodeBySeries(tvDbSeriesId); var episodes = episodeProvider.GetEpisodeBySeries(tvDbSeriesId);
Assert.IsNotEmpty(episodes); episodes.Should().NotBeEmpty();
} }
} }
} }

@ -3,8 +3,9 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using AutoMoq; using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using MbUnit.Framework; using FluentAssertions;
using Moq; using Moq;
using NUnit.Framework;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
@ -94,7 +95,7 @@ namespace NzbDrone.Core.Test
.WhereRandom(1).Has(c => c.Quality = new Quality(QualityTypes.DVD, true)) .WhereRandom(1).Has(c => c.Quality = new Quality(QualityTypes.DVD, true))
.Build(); .Build();
Assert.Count(1, parseResults.Where(c => c.Quality.Proper)); parseResults.Where(c => c.Quality.Proper).Should().HaveCount(1);
var episode = Builder<Episode>.CreateNew().Build(); var episode = Builder<Episode>.CreateNew().Build();
@ -199,9 +200,9 @@ namespace NzbDrone.Core.Test
[Test] [Test]
[Row(0)] [TestCase(0)]
[Row(-1)] [TestCase(-1)]
[Row(-100)] [TestCase(-100)]
[ExpectedException(typeof(ArgumentOutOfRangeException))] [ExpectedException(typeof(ArgumentOutOfRangeException))]
public void start_target_id_less_than_0_throws_exception(int target) public void start_target_id_less_than_0_throws_exception(int target)
{ {

@ -2,7 +2,7 @@
// ReSharper disable RedundantUsingDirective // ReSharper disable RedundantUsingDirective
using System; using System;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using MbUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
@ -14,10 +14,10 @@ namespace NzbDrone.Core.Test
public class EpisodeStatusTest : TestBase public class EpisodeStatusTest : TestBase
{ {
[Test] [Test]
[Row(1, false, false, EpisodeStatusType.NotAired)] [TestCase(1, false, false, EpisodeStatusType.NotAired)]
[Row(-2, false, false, EpisodeStatusType.Missing)] [TestCase(-2, false, false, EpisodeStatusType.Missing)]
[Row(1, true, false, EpisodeStatusType.Ready)] [TestCase(1, true, false, EpisodeStatusType.Ready)]
[Row(1, false, true, EpisodeStatusType.Ignored)] [TestCase(1, false, true, EpisodeStatusType.Ignored)]
public void no_grab_date(int offsetDays, bool hasEpisodes, bool ignored, EpisodeStatusType status) public void no_grab_date(int offsetDays, bool hasEpisodes, bool ignored, EpisodeStatusType status)
{ {
Episode episode = Builder<Episode>.CreateNew() Episode episode = Builder<Episode>.CreateNew()
@ -39,10 +39,10 @@ namespace NzbDrone.Core.Test
[Test] [Test]
[Row(1, false, false, EpisodeStatusType.NotAired)] [TestCase(1, false, false, EpisodeStatusType.NotAired)]
[Row(-2, false, false, EpisodeStatusType.Missing)] [TestCase(-2, false, false, EpisodeStatusType.Missing)]
[Row(1, true, false, EpisodeStatusType.Ready)] [TestCase(1, true, false, EpisodeStatusType.Ready)]
[Row(1, false, true, EpisodeStatusType.Ignored)] [TestCase(1, false, true, EpisodeStatusType.Ignored)]
public void old_grab_date(int offsetDays, bool hasEpisodes, bool ignored, public void old_grab_date(int offsetDays, bool hasEpisodes, bool ignored,
EpisodeStatusType status) EpisodeStatusType status)
{ {
@ -65,11 +65,11 @@ namespace NzbDrone.Core.Test
[Test] [Test]
[Row(1, false, false, EpisodeStatusType.Downloading)] [TestCase(1, false, false, EpisodeStatusType.Downloading)]
[Row(-2, false, false, EpisodeStatusType.Downloading)] [TestCase(-2, false, false, EpisodeStatusType.Downloading)]
[Row(1, true, false, EpisodeStatusType.Downloading)] [TestCase(1, true, false, EpisodeStatusType.Downloading)]
[Row(1, true, true, EpisodeStatusType.Downloading)] [TestCase(1, true, true, EpisodeStatusType.Downloading)]
[Row(1, false, true, EpisodeStatusType.Downloading)] [TestCase(1, false, true, EpisodeStatusType.Downloading)]
public void recent_grab_date(int offsetDays, bool hasEpisodes, bool ignored, public void recent_grab_date(int offsetDays, bool hasEpisodes, bool ignored,
EpisodeStatusType status) EpisodeStatusType status)
{ {
@ -91,9 +91,9 @@ namespace NzbDrone.Core.Test
} }
[Test] [Test]
[Row(1, false, false, EpisodeStatusType.Ignored)] [TestCase(1, false, false, EpisodeStatusType.Ignored)]
[Row(-2, false, false, EpisodeStatusType.Ignored)] [TestCase(-2, false, false, EpisodeStatusType.Ignored)]
[Row(1, false, true, EpisodeStatusType.Ignored)] [TestCase(1, false, true, EpisodeStatusType.Ignored)]
public void skipped_season(int offsetDays, bool hasEpisodes, bool ignored, EpisodeStatusType status) public void skipped_season(int offsetDays, bool hasEpisodes, bool ignored, EpisodeStatusType status)
{ {
Episode episode = Builder<Episode>.CreateNew() Episode episode = Builder<Episode>.CreateNew()

@ -1,8 +1,8 @@
// ReSharper disable RedundantUsingDirective // ReSharper disable RedundantUsingDirective
using AutoMoq; using AutoMoq;
using MbUnit.Framework;
using Moq; using Moq;
using System; using System;
using NUnit.Framework;
namespace NzbDrone.Core.Test namespace NzbDrone.Core.Test
{ {

@ -4,7 +4,7 @@ using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using NLog; using NLog;
using NLog.Targets; using NLog.Targets;
using MbUnit.Framework; using NUnit.Framework;
namespace NzbDrone.Core.Test.Framework namespace NzbDrone.Core.Test.Framework
{ {
@ -25,7 +25,7 @@ namespace NzbDrone.Core.Test.Framework
_logs = new List<LogEventInfo>(); _logs = new List<LogEventInfo>();
} }
internal static void AssertNoError() internal static void AssertNoUnexcpectedLogs()
{ {
ExcpectedFatals(0); ExcpectedFatals(0);
ExcpectedErrors(0); ExcpectedErrors(0);

@ -1,46 +1,26 @@
// ReSharper disable RedundantUsingDirective
using System; using System;
using System.IO; using System.IO;
using MbUnit.Framework;
using NLog; using NLog;
using NLog.Config; using NLog.Config;
using NUnit.Framework;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test namespace NzbDrone.Core.Test
{ {
[AssemblyFixture] [SetUpFixture]
public class Fixtures public class Fixtures
{ {
[TearDown] [TearDown]
public void TearDown() public void TearDown()
{ {
foreach ( var filesToDelete = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.db", SearchOption.AllDirectories);
var file in Directory.GetFiles(Directory.GetCurrentDirectory(), "*.db", SearchOption.AllDirectories)) foreach (var file in filesToDelete)
{ {
try try
{ {
File.Delete(file); File.Delete(file);
} }
catch catch{}
{
}
}
}
[FixtureTearDown]
public void FixtureTearDown()
{
foreach (var file in Directory.GetFiles(Directory.GetCurrentDirectory(), "*.db", SearchOption.AllDirectories)
)
{
try
{
File.Delete(file);
}
catch
{
}
} }
} }

@ -1,4 +1,5 @@
using MbUnit.Framework; using NUnit;
using NUnit.Framework;
namespace NzbDrone.Core.Test.Framework namespace NzbDrone.Core.Test.Framework
{ {
@ -15,7 +16,7 @@ namespace NzbDrone.Core.Test.Framework
[TearDown] [TearDown]
public void TearDown() public void TearDown()
{ {
if (!Assert.IsFailurePending) ExceptionVerification.AssertNoError(); ExceptionVerification.AssertNoUnexcpectedLogs();
} }
} }

@ -1,23 +0,0 @@
using NUnit;
using NUnit.Framework;
namespace NzbDrone.Core.Test.Framework
{
public class TestBaseNunit
// ReSharper disable InconsistentNaming
{
[SetUp]
public void Setup()
{
ExceptionVerification.Reset();
}
[TearDown]
public void TearDown()
{
ExceptionVerification.AssertNoError();
}
}
}

@ -4,8 +4,9 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using AutoMoq; using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using MbUnit.Framework; using FluentAssertions;
using Moq; using Moq;
using NUnit.Framework;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
@ -121,7 +122,7 @@ namespace NzbDrone.Core.Test
var storedHistory = repo.All<History>(); var storedHistory = repo.All<History>();
var newHistiory = repo.All<History>().First(); var newHistiory = repo.All<History>().First();
Assert.Count(1, storedHistory); storedHistory.Should().HaveCount(1);
Assert.AreEqual(history.Date, newHistiory.Date); Assert.AreEqual(history.Date, newHistiory.Date);
Assert.AreEqual(history.EpisodeId, newHistiory.EpisodeId); Assert.AreEqual(history.EpisodeId, newHistiory.EpisodeId);
Assert.AreEqual(history.NzbTitle, newHistiory.NzbTitle); Assert.AreEqual(history.NzbTitle, newHistiory.NzbTitle);

@ -4,8 +4,8 @@ using System.Collections.Generic;
using System.Threading; using System.Threading;
using AutoMoq; using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using MbUnit.Framework;
using Moq; using Moq;
using NUnit.Framework;
using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Jobs; using NzbDrone.Core.Providers.Jobs;
@ -79,7 +79,7 @@ namespace NzbDrone.Core.Test
[Test] [Test]
[Timeout(3)] [Timeout(3000)]
public void failed_import_should_not_be_stuck_in_loop() public void failed_import_should_not_be_stuck_in_loop()
{ {
var series = Builder<Series>.CreateListOfSize(2) var series = Builder<Series>.CreateListOfSize(2)

@ -6,8 +6,8 @@ using System.Net;
using System.ServiceModel.Syndication; using System.ServiceModel.Syndication;
using AutoMoq; using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using MbUnit.Framework;
using Moq; using Moq;
using NUnit.Framework;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Core;
@ -16,6 +16,7 @@ using NzbDrone.Core.Providers.Indexer;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
using FluentAssertions;
namespace NzbDrone.Core.Test namespace NzbDrone.Core.Test
{ {
@ -38,8 +39,11 @@ namespace NzbDrone.Core.Test
indexerProvider.SaveSettings(settings); indexerProvider.SaveSettings(settings);
//Assert //Assert
Assert.Count(1, indexerProvider.GetAllISettings()); indexerProvider.GetAllISettings();
Assert.Count(1, indexerProvider.GetEnabledIndexers());
indexerProvider.GetAllISettings().Should().HaveCount(1);
indexerProvider.GetEnabledIndexers().Should().HaveCount(1);
} }
[Test] [Test]
@ -57,8 +61,9 @@ namespace NzbDrone.Core.Test
indexerProvider.SaveSettings(settings); indexerProvider.SaveSettings(settings);
//Assert //Assert
Assert.Count(1, indexerProvider.GetAllISettings());
Assert.IsEmpty(indexerProvider.GetEnabledIndexers()); indexerProvider.GetAllISettings().Should().HaveCount(1);
indexerProvider.GetEnabledIndexers().Should().BeEmpty();
} }
} }

@ -6,10 +6,9 @@ using System.ServiceModel.Syndication;
using System.Text; using System.Text;
using AutoMoq; using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using Gallio.Framework; using FluentAssertions;
using MbUnit.Framework;
using MbUnit.Framework.ContractVerifiers;
using Moq; using Moq;
using NUnit.Framework;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Core;
@ -25,10 +24,10 @@ namespace NzbDrone.Core.Test
public class IndexerTests : TestBase public class IndexerTests : TestBase
{ {
[Test] [Test]
[Row("nzbsorg.xml", 0)] [TestCase("nzbsorg.xml", 0)]
[Row("nzbsrus.xml", 6)] [TestCase("nzbsrus.xml", 6)]
[Row("newzbin.xml", 1)] [TestCase("newzbin.xml", 1)]
[Row("nzbmatrix.xml", 1)] [TestCase("nzbmatrix.xml", 1)]
public void parse_feed_xml(string fileName, int warns) public void parse_feed_xml(string fileName, int warns)
{ {
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
@ -48,15 +47,13 @@ namespace NzbDrone.Core.Test
foreach (var episodeParseResult in parseResults) foreach (var episodeParseResult in parseResults)
{ {
var Uri = new Uri(episodeParseResult.NzbUrl); var Uri = new Uri(episodeParseResult.NzbUrl);
Assert.DoesNotContain(Uri.PathAndQuery, "//"); Uri.PathAndQuery.Should().NotContain("//");
} }
Assert.IsNotEmpty(parseResults); parseResults.Should().NotBeEmpty();
parseResults.Should().OnlyContain(s => s.Indexer == mockIndexer.Name);
Assert.ForAll(parseResults, s => Assert.AreEqual(mockIndexer.Name, s.Indexer)); parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.NzbTitle));
Assert.ForAll(parseResults, s => Assert.AreNotEqual("", s.NzbTitle));
Assert.ForAll(parseResults, s => Assert.AreNotEqual(null, s.NzbTitle));
ExceptionVerification.ExcpectedWarns(warns); ExceptionVerification.ExcpectedWarns(warns);
} }
@ -81,21 +78,21 @@ namespace NzbDrone.Core.Test
foreach (var episodeParseResult in parseResults) foreach (var episodeParseResult in parseResults)
{ {
var Uri = new Uri(episodeParseResult.NzbUrl); var Uri = new Uri(episodeParseResult.NzbUrl);
Assert.DoesNotContain(Uri.PathAndQuery, "//"); Uri.PathAndQuery.Should().NotContain("//");
} }
Assert.IsNotEmpty(parseResults); parseResults.Should().NotBeEmpty();
Assert.ForAll(parseResults, s => Assert.AreEqual(newzbinProvider.Name, s.Indexer)); parseResults.Should().OnlyContain(s => s.Indexer == newzbinProvider.Name);
Assert.ForAll(parseResults, s => Assert.AreNotEqual("", s.NzbTitle)); parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.NzbTitle));
Assert.ForAll(parseResults, s => Assert.AreNotEqual(null, s.NzbTitle));
ExceptionVerification.ExcpectedWarns(1); ExceptionVerification.ExcpectedWarns(1);
} }
[Test] [Test]
[Row("Adventure.Inc.S03E19.DVDRip.XviD-OSiTV", 3, 19, QualityTypes.DVD)] [TestCase("Adventure.Inc.S03E19.DVDRip.XviD-OSiTV", 3, 19, QualityTypes.DVD)]
public void custome_parser_partial_success(string title, int season, int episode, QualityTypes quality) public void custome_parser_partial_success(string title, int season, int episode, QualityTypes quality)
{ {
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
@ -123,7 +120,7 @@ namespace NzbDrone.Core.Test
[Test] [Test]
[Row("Adventure.Inc.DVDRip.XviD-OSiTV")] [TestCase("Adventure.Inc.DVDRip.XviD-OSiTV")]
public void custome_parser_full_parse(string title) public void custome_parser_full_parse(string title)
{ {
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
@ -184,10 +181,10 @@ namespace NzbDrone.Core.Test
var result = mocker.Resolve<NzbsOrg>().FetchEpisode("Simpsons", 21, 23); var result = mocker.Resolve<NzbsOrg>().FetchEpisode("Simpsons", 21, 23);
Assert.IsNotEmpty(result); result.Should().NotBeEmpty();
Assert.ForAll(result, r => r.CleanTitle == "simpsons"); result.Should().OnlyContain(r => r.CleanTitle == "simpsons");
Assert.ForAll(result, r => r.SeasonNumber == 21); result.Should().OnlyContain(r => r.SeasonNumber == 21);
Assert.ForAll(result, r => r.EpisodeNumbers.Contains(23)); result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(23));
} }
@ -209,10 +206,11 @@ namespace NzbDrone.Core.Test
var result = mocker.Resolve<NzbsOrg>().FetchEpisode("Blue Bloods", 1, 19); var result = mocker.Resolve<NzbsOrg>().FetchEpisode("Blue Bloods", 1, 19);
Assert.IsNotEmpty(result); result.Should().NotBeEmpty();
Assert.ForAll(result, r => r.CleanTitle == "bluebloods"); result.Should().OnlyContain(r => r.CleanTitle == "bluebloods");
Assert.ForAll(result, r => r.SeasonNumber == 1); result.Should().OnlyContain(r => r.SeasonNumber == 1);
Assert.ForAll(result, r => r.EpisodeNumbers.Contains(19)); result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(19));
} }
} }
} }

@ -6,8 +6,9 @@ using System.Net;
using System.ServiceModel.Syndication; using System.ServiceModel.Syndication;
using AutoMoq; using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using MbUnit.Framework; using FluentAssertions;
using Moq; using Moq;
using NUnit.Framework;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Core;
@ -199,7 +200,7 @@ namespace NzbDrone.Core.Test
//Assert //Assert
Assert.IsTrue(result); Assert.IsTrue(result);
Assert.AreSame(series, parseResultSingle.Series); Assert.AreSame(series, parseResultSingle.Series);
Assert.Count(1, parseResultSingle.Episodes); parseResultSingle.Episodes.Should().HaveCount(1);
Assert.AreEqual("TBD", parseResultSingle.Episodes[0].Title); Assert.AreEqual("TBD", parseResultSingle.Episodes[0].Title);
mocker.VerifyAllMocks(); mocker.VerifyAllMocks();
} }

@ -3,8 +3,8 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using AutoMoq; using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using MbUnit.Framework;
using Moq; using Moq;
using NUnit.Framework;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
@ -206,17 +206,17 @@ namespace NzbDrone.Core.Test
//Should Download //Should Download
[Test] [Test]
[Row(QualityTypes.SDTV, true, QualityTypes.HDTV, false, true)] [TestCase(QualityTypes.SDTV, true, QualityTypes.HDTV, false, true)]
[Row(QualityTypes.DVD, true, QualityTypes.Bluray720p, true, true)] [TestCase(QualityTypes.DVD, true, QualityTypes.Bluray720p, true, true)]
[Row(QualityTypes.HDTV, false, QualityTypes.HDTV, true, true)] [TestCase(QualityTypes.HDTV, false, QualityTypes.HDTV, true, true)]
[Row(QualityTypes.HDTV, false, QualityTypes.HDTV, false, false)] [TestCase(QualityTypes.HDTV, false, QualityTypes.HDTV, false, false)]
[Row(QualityTypes.Bluray720p, true, QualityTypes.Bluray1080p, false, false)] [TestCase(QualityTypes.Bluray720p, true, QualityTypes.Bluray1080p, false, false)]
[Row(QualityTypes.HDTV, true, QualityTypes.Bluray720p, true, true)] [TestCase(QualityTypes.HDTV, true, QualityTypes.Bluray720p, true, true)]
[Row(QualityTypes.Bluray1080p, true, QualityTypes.Bluray720p, true, false)] [TestCase(QualityTypes.Bluray1080p, true, QualityTypes.Bluray720p, true, false)]
[Row(QualityTypes.Bluray1080p, true, QualityTypes.Bluray720p, false, false)] [TestCase(QualityTypes.Bluray1080p, true, QualityTypes.Bluray720p, false, false)]
[Row(QualityTypes.Bluray1080p, false, QualityTypes.Bluray720p, true, false)] [TestCase(QualityTypes.Bluray1080p, false, QualityTypes.Bluray720p, true, false)]
[Row(QualityTypes.HDTV, false, QualityTypes.Bluray720p, true, true)] [TestCase(QualityTypes.HDTV, false, QualityTypes.Bluray720p, true, true)]
[Row(QualityTypes.HDTV, true, QualityTypes.HDTV, false, false)] [TestCase(QualityTypes.HDTV, true, QualityTypes.HDTV, false, false)]
public void Is_upgrade(QualityTypes fileQuality, bool isFileProper, QualityTypes reportQuality, public void Is_upgrade(QualityTypes fileQuality, bool isFileProper, QualityTypes reportQuality,
bool isReportProper, bool excpected) bool isReportProper, bool excpected)
{ {

@ -3,7 +3,8 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading; using System.Threading;
using AutoMoq; using AutoMoq;
using MbUnit.Framework; using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers.Jobs; using NzbDrone.Core.Providers.Jobs;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
@ -227,7 +228,8 @@ namespace NzbDrone.Core.Test
//Assert //Assert
Assert.Count(1, timers);
timers.Should().HaveCount(1);
Assert.AreEqual(fakeTimer.DefaultInterval, timers[0].Interval); Assert.AreEqual(fakeTimer.DefaultInterval, timers[0].Interval);
Assert.AreEqual(fakeTimer.Name, timers[0].Name); Assert.AreEqual(fakeTimer.Name, timers[0].Name);
Assert.AreEqual(fakeTimer.GetType().ToString(), timers[0].TypeName); Assert.AreEqual(fakeTimer.GetType().ToString(), timers[0].TypeName);
@ -264,7 +266,7 @@ namespace NzbDrone.Core.Test
//Assert //Assert
Assert.Count(1, timers); timers.Should().HaveCount(1);
Assert.IsTrue(timers[0].Enable); Assert.IsTrue(timers[0].Enable);
} }
@ -295,7 +297,7 @@ namespace NzbDrone.Core.Test
//Assert //Assert
Assert.Count(1, timers); timers.Should().HaveCount(1);
Assert.IsFalse(timers[0].Enable); Assert.IsFalse(timers[0].Enable);
} }

@ -5,8 +5,9 @@ using System.Linq.Expressions;
using System.Linq; using System.Linq;
using AutoMoq; using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using MbUnit.Framework; using FluentAssertions;
using Moq; using Moq;
using NUnit.Framework;
using NzbDrone.Core.Model.Notification; using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Core;
@ -358,8 +359,9 @@ namespace NzbDrone.Core.Test
var result = mocker.Resolve<MediaFileProvider>().GetSeasonFiles(12); var result = mocker.Resolve<MediaFileProvider>().GetSeasonFiles(12);
Assert.Count(8, result);
Assert.DoesNotContain(result, null); result.Should().HaveCount(8);
result.Should().NotContainNulls();
mocker.VerifyAllMocks(); mocker.VerifyAllMocks();

@ -40,10 +40,8 @@
<HintPath>..\packages\NBuilder.2.3.0.0\lib\FizzWare.NBuilder.dll</HintPath> <HintPath>..\packages\NBuilder.2.3.0.0\lib\FizzWare.NBuilder.dll</HintPath>
</Reference> </Reference>
<Reference Include="FluentAssertions"> <Reference Include="FluentAssertions">
<HintPath>..\packages\FluentAssertions.1.4.0.0\Lib\.NetFramework 4.0\FluentAssertions.dll</HintPath> <HintPath>..\Libraries\FluentAssertions.dll</HintPath>
</Reference> </Reference>
<Reference Include="Gallio, Version=3.2.0.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL" />
<Reference Include="MbUnit, Version=3.2.0.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL" />
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <Reference Include="Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\CommonServiceLocator.1.0\lib\NET35\Microsoft.Practices.ServiceLocation.dll</HintPath> <HintPath>..\packages\CommonServiceLocator.1.0\lib\NET35\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference> </Reference>
@ -93,7 +91,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="dbBenchmark.cs" /> <Compile Include="dbBenchmark.cs" />
<Compile Include="Framework\TestBaseNunit.cs" /> <Compile Include="Framework\TestBase.cs" />
<Compile Include="InventoryProvider_IsMonitoredTest.cs" /> <Compile Include="InventoryProvider_IsMonitoredTest.cs" />
<Compile Include="DownloadProviderTest.cs" /> <Compile Include="DownloadProviderTest.cs" />
<Compile Include="EpisodeSearchJobTest.cs" /> <Compile Include="EpisodeSearchJobTest.cs" />
@ -111,7 +109,6 @@
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="Framework\ExceptionVerification.cs" /> <Compile Include="Framework\ExceptionVerification.cs" />
<Compile Include="Framework\TestBase.cs" />
<Compile Include="JobProviderTest.cs" /> <Compile Include="JobProviderTest.cs" />
<Compile Include="QualityTest.cs" /> <Compile Include="QualityTest.cs" />
<Compile Include="RepositoryProviderTest.cs" /> <Compile Include="RepositoryProviderTest.cs" />
@ -121,7 +118,7 @@
<Compile Include="MediaFileProviderTests.cs" /> <Compile Include="MediaFileProviderTests.cs" />
<Compile Include="ConfigProviderTest.cs" /> <Compile Include="ConfigProviderTest.cs" />
<Compile Include="EpisodeProviderTest.cs" /> <Compile Include="EpisodeProviderTest.cs" />
<Compile Include="Fixtures.cs" /> <Compile Include="Framework\Fixtures.cs" />
<Compile Include="Framework\MockLib.cs" /> <Compile Include="Framework\MockLib.cs" />
<Compile Include="ParserTest.cs" /> <Compile Include="ParserTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />

@ -1,6 +1,7 @@
// ReSharper disable RedundantUsingDirective // ReSharper disable RedundantUsingDirective
using System; using System;
using MbUnit.Framework; using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
@ -21,27 +22,27 @@ namespace NzbDrone.Core.Test
[Test] [Test]
[Row("Sonny.With.a.Chance.S02E15", "Sonny.With.a.Chance", 2, 15)] [TestCase("Sonny.With.a.Chance.S02E15", "Sonny.With.a.Chance", 2, 15)]
[Row("Two.and.a.Half.Me.103.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Me", 1, 3)] [TestCase("Two.and.a.Half.Me.103.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Me", 1, 3)]
[Row("Two.and.a.Half.Me.113.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Me", 1, 13)] [TestCase("Two.and.a.Half.Me.113.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Me", 1, 13)]
[Row("Two.and.a.Half.Me.1013.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Me", 10, 13)] [TestCase("Two.and.a.Half.Me.1013.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Me", 10, 13)]
[Row("Chuck.4x05.HDTV.XviD-LOL", "Chuck", 4, 5)] [TestCase("Chuck.4x05.HDTV.XviD-LOL", "Chuck", 4, 5)]
[Row("The.Girls.Next.Door.S03E06.DVDRip.XviD-WiDE", "The.Girls.Next.Door", 3, 6)] [TestCase("The.Girls.Next.Door.S03E06.DVDRip.XviD-WiDE", "The.Girls.Next.Door", 3, 6)]
[Row("Degrassi.S10E27.WS.DSR.XviD-2HD", "Degrassi", 10, 27)] [TestCase("Degrassi.S10E27.WS.DSR.XviD-2HD", "Degrassi", 10, 27)]
[Row("Parenthood.2010.S02E14.HDTV.XviD-LOL", "Parenthood 2010", 2, 14)] [TestCase("Parenthood.2010.S02E14.HDTV.XviD-LOL", "Parenthood 2010", 2, 14)]
[Row("Hawaii Five 0 S01E19 720p WEB DL DD5 1 H 264 NT", "Hawaii Five", 1, 19)] [TestCase("Hawaii Five 0 S01E19 720p WEB DL DD5 1 H 264 NT", "Hawaii Five", 1, 19)]
[Row("The Event S01E14 A Message Back 720p WEB DL DD5 1 H264 SURFER", "The Event", 1, 14)] [TestCase("The Event S01E14 A Message Back 720p WEB DL DD5 1 H264 SURFER", "The Event", 1, 14)]
[Row("Adam Hills In Gordon St Tonight S01E07 WS PDTV XviD FUtV", "Adam Hills In Gordon St Tonight", 1, 7)] [TestCase("Adam Hills In Gordon St Tonight S01E07 WS PDTV XviD FUtV", "Adam Hills In Gordon St Tonight", 1, 7)]
[Row("Adam Hills In Gordon St Tonight S01E07 WS PDTV XviD FUtV", "Adam Hills In Gordon St Tonight", 1, 7)] [TestCase("Adam Hills In Gordon St Tonight S01E07 WS PDTV XviD FUtV", "Adam Hills In Gordon St Tonight", 1, 7)]
[Row("Adventure.Inc.S03E19.DVDRip.XviD-OSiTV", "Adventure.Inc", 3, 19)] [TestCase("Adventure.Inc.S03E19.DVDRip.XviD-OSiTV", "Adventure.Inc", 3, 19)]
[Row("S03E09 WS PDTV XviD FUtV", "", 3, 9)] [TestCase("S03E09 WS PDTV XviD FUtV", "", 3, 9)]
[Row("5x10 WS PDTV XviD FUtV", "", 5, 10)] [TestCase("5x10 WS PDTV XviD FUtV", "", 5, 10)]
[Row("Castle.2009.S01E14.HDTV.XviD-LOL", "Castle 2009", 1, 14)] [TestCase("Castle.2009.S01E14.HDTV.XviD-LOL", "Castle 2009", 1, 14)]
[Row("Pride.and.Prejudice.1995.S03E20.HDTV.XviD-LOL", "Pride and Prejudice 1995", 3, 20)] [TestCase("Pride.and.Prejudice.1995.S03E20.HDTV.XviD-LOL", "Pride and Prejudice 1995", 3, 20)]
//[Row(@"Season 4\07 WS PDTV XviD FUtV", "", 4, 7)] //[Row(@"Season 4\07 WS PDTV XviD FUtV", "", 4, 7)]
[Row("The.Office.S03E115.DVDRip.XviD-OSiTV", "The.Office", 3, 115)] [TestCase("The.Office.S03E115.DVDRip.XviD-OSiTV", "The.Office", 3, 115)]
[Row(@"Parks and Recreation - S02E21 - 94 Meetings - 720p TV.mkv", "Parks and Recreation", 2, 21)] [TestCase(@"Parks and Recreation - S02E21 - 94 Meetings - 720p TV.mkv", "Parks and Recreation", 2, 21)]
[Row(@"24-7 Penguins-Capitals- Road to the NHL Winter Classic - S01E03 - Episode 3.mkv", "24-7 Penguins-Capitals- Road to the NHL Winter Classic", 1, 3)] [TestCase(@"24-7 Penguins-Capitals- Road to the NHL Winter Classic - S01E03 - Episode 3.mkv", "24-7 Penguins-Capitals- Road to the NHL Winter Classic", 1, 3)]
public void episode_parse(string postTitle, string title, int season, int episode) public void episode_parse(string postTitle, string title, int season, int episode)
{ {
var result = Parser.ParseEpisodeInfo(postTitle); var result = Parser.ParseEpisodeInfo(postTitle);
@ -52,51 +53,51 @@ namespace NzbDrone.Core.Test
} }
[Test] [Test]
[Row(@"z:\tv shows\battlestar galactica (2003)\Season 3\S03E05 - Collaborators.mkv", 3, 5)] [TestCase(@"z:\tv shows\battlestar galactica (2003)\Season 3\S03E05 - Collaborators.mkv", 3, 5)]
[Row(@"z:\tv shows\modern marvels\Season 16\S16E03 - The Potato.mkv", 16, 3)] [TestCase(@"z:\tv shows\modern marvels\Season 16\S16E03 - The Potato.mkv", 16, 3)]
[Row(@"z:\tv shows\robot chicken\Specials\S00E16 - Dear Consumer - SD TV.avi", 0, 16)] [TestCase(@"z:\tv shows\robot chicken\Specials\S00E16 - Dear Consumer - SD TV.avi", 0, 16)]
[Row(@"D:\shares\TV Shows\Parks And Recreation\Season 2\S02E21 - 94 Meetings - 720p TV.mkv", 2, 21)] [TestCase(@"D:\shares\TV Shows\Parks And Recreation\Season 2\S02E21 - 94 Meetings - 720p TV.mkv", 2, 21)]
[Row(@"D:\shares\TV Shows\Battlestar Galactica (2003)\Season 2\S02E21.avi", 2, 21)] [TestCase(@"D:\shares\TV Shows\Battlestar Galactica (2003)\Season 2\S02E21.avi", 2, 21)]
public void file_path_parse(string path, int season, int episode) public void file_path_parse(string path, int season, int episode)
{ {
var result = Parser.ParseEpisodeInfo(path); var result = Parser.ParseEpisodeInfo(path);
Assert.Count(1, result.EpisodeNumbers); result.EpisodeNumbers.Should().HaveCount(1);
Assert.AreEqual(season, result.SeasonNumber); Assert.AreEqual(season, result.SeasonNumber);
Assert.AreEqual(episode, result.EpisodeNumbers[0]); Assert.AreEqual(episode, result.EpisodeNumbers[0]);
} }
[Test] [Test]
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", QualityTypes.DVD)] [TestCase("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", QualityTypes.DVD)]
[Row("WEEDS.S03E01-06.DUAL.BDRip.X-viD.AC3.-HELLYWOOD", QualityTypes.DVD)] [TestCase("WEEDS.S03E01-06.DUAL.BDRip.X-viD.AC3.-HELLYWOOD", QualityTypes.DVD)]
[Row("WEEDS.S03E01-06.DUAL.BDRip.AC3.-HELLYWOOD", QualityTypes.DVD)] [TestCase("WEEDS.S03E01-06.DUAL.BDRip.AC3.-HELLYWOOD", QualityTypes.DVD)]
[Row("Two.and.a.Half.Men.S08E05.720p.HDTV.X264-DIMENSION", QualityTypes.HDTV)] [TestCase("Two.and.a.Half.Men.S08E05.720p.HDTV.X264-DIMENSION", QualityTypes.HDTV)]
[Row("this has no extention or periods HDTV", QualityTypes.SDTV)] [TestCase("this has no extention or periods HDTV", QualityTypes.SDTV)]
[Row("Chuck.S04E05.HDTV.XviD-LOL", QualityTypes.SDTV)] [TestCase("Chuck.S04E05.HDTV.XviD-LOL", QualityTypes.SDTV)]
[Row("The.Girls.Next.Door.S03E06.DVDRip.XviD-WiDE", QualityTypes.DVD)] [TestCase("The.Girls.Next.Door.S03E06.DVDRip.XviD-WiDE", QualityTypes.DVD)]
[Row("The.Girls.Next.Door.S03E06.DVD.Rip.XviD-WiDE", QualityTypes.DVD)] [TestCase("The.Girls.Next.Door.S03E06.DVD.Rip.XviD-WiDE", QualityTypes.DVD)]
[Row("The.Girls.Next.Door.S03E06.HDTV-WiDE", QualityTypes.SDTV)] [TestCase("The.Girls.Next.Door.S03E06.HDTV-WiDE", QualityTypes.SDTV)]
[Row("Degrassi.S10E27.WS.DSR.XviD-2HD", QualityTypes.SDTV)] [TestCase("Degrassi.S10E27.WS.DSR.XviD-2HD", QualityTypes.SDTV)]
[Row("Sonny.With.a.Chance.S02E15.720p.WEB-DL.DD5.1.H.264-SURFER", QualityTypes.WEBDL)] [TestCase("Sonny.With.a.Chance.S02E15.720p.WEB-DL.DD5.1.H.264-SURFER", QualityTypes.WEBDL)]
[Row("Sonny.With.a.Chance.S02E15.720p", QualityTypes.HDTV)] [TestCase("Sonny.With.a.Chance.S02E15.720p", QualityTypes.HDTV)]
[Row("Sonny.With.a.Chance.S02E15.mkv", QualityTypes.HDTV)] [TestCase("Sonny.With.a.Chance.S02E15.mkv", QualityTypes.HDTV)]
[Row("Sonny.With.a.Chance.S02E15.avi", QualityTypes.SDTV)] [TestCase("Sonny.With.a.Chance.S02E15.avi", QualityTypes.SDTV)]
[Row("Sonny.With.a.Chance.S02E15.xvid", QualityTypes.SDTV)] [TestCase("Sonny.With.a.Chance.S02E15.xvid", QualityTypes.SDTV)]
[Row("Sonny.With.a.Chance.S02E15.divx", QualityTypes.SDTV)] [TestCase("Sonny.With.a.Chance.S02E15.divx", QualityTypes.SDTV)]
[Row("Sonny.With.a.Chance.S02E15", QualityTypes.Unknown)] [TestCase("Sonny.With.a.Chance.S02E15", QualityTypes.Unknown)]
[Row("Chuck - S01E04 - So Old - Playdate - 720p TV.mkv", QualityTypes.HDTV)] [TestCase("Chuck - S01E04 - So Old - Playdate - 720p TV.mkv", QualityTypes.HDTV)]
[Row("Chuck - S22E03 - MoneyBART - HD TV.mkv", QualityTypes.HDTV)] [TestCase("Chuck - S22E03 - MoneyBART - HD TV.mkv", QualityTypes.HDTV)]
[Row("Chuck - S01E03 - Come Fly With Me - 720p BluRay.mkv", QualityTypes.Bluray720p)] [TestCase("Chuck - S01E03 - Come Fly With Me - 720p BluRay.mkv", QualityTypes.Bluray720p)]
[Row("Chuck - S01E03 - Come Fly With Me - 1080p BluRay.mkv", QualityTypes.Bluray1080p)] [TestCase("Chuck - S01E03 - Come Fly With Me - 1080p BluRay.mkv", QualityTypes.Bluray1080p)]
[Row("Chuck - S11E06 - D-Yikes! - 720p WEB-DL.mkv", QualityTypes.WEBDL)] [TestCase("Chuck - S11E06 - D-Yikes! - 720p WEB-DL.mkv", QualityTypes.WEBDL)]
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", QualityTypes.DVD)] [TestCase("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", QualityTypes.DVD)]
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", QualityTypes.DVD)] [TestCase("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", QualityTypes.DVD)]
[Row("Law & Order: Special Victims Unit - 11x11 - Quickie", QualityTypes.Unknown)] [TestCase("Law & Order: Special Victims Unit - 11x11 - Quickie", QualityTypes.Unknown)]
[Row("(<a href=\"http://www.newzbin.com/browse/post/6076286/nzb/\">NZB</a>)", QualityTypes.Unknown)] [TestCase("(<a href=\"http://www.newzbin.com/browse/post/6076286/nzb/\">NZB</a>)", QualityTypes.Unknown)]
[Row("S07E23 - [HDTV].mkv ", QualityTypes.HDTV)] [TestCase("S07E23 - [HDTV].mkv ", QualityTypes.HDTV)]
[Row("S07E23 - [WEBDL].mkv ", QualityTypes.WEBDL)] [TestCase("S07E23 - [WEBDL].mkv ", QualityTypes.WEBDL)]
[Row("S07E23.mkv ", QualityTypes.HDTV)] [TestCase("S07E23.mkv ", QualityTypes.HDTV)]
[Row("S07E23 .avi ", QualityTypes.SDTV)] [TestCase("S07E23 .avi ", QualityTypes.SDTV)]
public void quality_parse(string postTitle, object quality) public void quality_parse(string postTitle, object quality)
{ {
var result = Parser.ParseQuality(postTitle); var result = Parser.ParseQuality(postTitle);
@ -127,31 +128,31 @@ namespace NzbDrone.Core.Test
} }
[Test] [Test]
[Timeout(1)] [Timeout(1000)]
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", "WEEDS", 3, new[] { 1, 2, 3, 4, 5, 6 }, 6)] [TestCase("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", "WEEDS", 3, new[] { 1, 2, 3, 4, 5, 6 }, 6)]
[Row("Two.and.a.Half.Men.103.104.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Men", 1, new[] { 3, 4 }, 2)] [TestCase("Two.and.a.Half.Men.103.104.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Men", 1, new[] { 3, 4 }, 2)]
[Row("Weeds.S03E01.S03E02.720p.HDTV.X264-DIMENSION", "Weeds", 3, new[] { 1, 2 }, 2)] [TestCase("Weeds.S03E01.S03E02.720p.HDTV.X264-DIMENSION", "Weeds", 3, new[] { 1, 2 }, 2)]
[Row("The Borgias S01e01 e02 ShoHD On Demand 1080i DD5 1 ALANiS", "The Borgias", 1, new[] { 1, 2 }, 2)] [TestCase("The Borgias S01e01 e02 ShoHD On Demand 1080i DD5 1 ALANiS", "The Borgias", 1, new[] { 1, 2 }, 2)]
[Row("Big Time Rush 1x01 to 10 480i DD2 0 Sianto", "Big Time Rush", 1, new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, 10)] [TestCase("Big Time Rush 1x01 to 10 480i DD2 0 Sianto", "Big Time Rush", 1, new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, 10)]
[Row("White.Collar.2x04.2x05.720p.BluRay-FUTV", "White.Collar", 2, new[] { 4, 5 }, 2)] [TestCase("White.Collar.2x04.2x05.720p.BluRay-FUTV", "White.Collar", 2, new[] { 4, 5 }, 2)]
//[Row("The.Kennedys.Part.1.and.Part.2.DSR.XviD-SYS", 1, new[] { 1, 2 })] //[Row("The.Kennedys.Part.1.and.Part.2.DSR.XviD-SYS", 1, new[] { 1, 2 })]
public void episode_multipart_parse(string postTitle, string title, int season, int[] episodes, int count) public void episode_multipart_parse(string postTitle, string title, int season, int[] episodes, int count)
{ {
var result = Parser.ParseEpisodeInfo(postTitle); var result = Parser.ParseEpisodeInfo(postTitle);
Assert.AreEqual(season, result.SeasonNumber); Assert.AreEqual(season, result.SeasonNumber);
Assert.Count(episodes.Length, result.EpisodeNumbers); result.EpisodeNumbers.Should().HaveSameCount(episodes);
Assert.AreElementsEqualIgnoringOrder(episodes, result.EpisodeNumbers); result.EpisodeNumbers.Should().BeEquivalentTo(result.EpisodeNumbers);
Assert.AreEqual(Parser.NormalizeTitle(title), result.CleanTitle); Assert.AreEqual(Parser.NormalizeTitle(title), result.CleanTitle);
Assert.AreEqual(count, result.EpisodeNumbers.Count); Assert.AreEqual(count, result.EpisodeNumbers.Count);
} }
[Test] [Test]
[Row("Conan 2011 04 18 Emma Roberts HDTV XviD BFF", "Conan", 2011, 04, 18)] [TestCase("Conan 2011 04 18 Emma Roberts HDTV XviD BFF", "Conan", 2011, 04, 18)]
[Row("The Tonight Show With Jay Leno 2011 04 15 1080i HDTV DD5 1 MPEG2 TrollHD", "The Tonight Show With Jay Leno", 2011, 04, 15)] [TestCase("The Tonight Show With Jay Leno 2011 04 15 1080i HDTV DD5 1 MPEG2 TrollHD", "The Tonight Show With Jay Leno", 2011, 04, 15)]
[Row("The.Daily.Show.2010.10.11.Johnny.Knoxville.iTouch-MW", "The.Daily.Show", 2010, 10, 11)] [TestCase("The.Daily.Show.2010.10.11.Johnny.Knoxville.iTouch-MW", "The.Daily.Show", 2010, 10, 11)]
[Row("The Daily Show - 2011-04-12 - Gov. Deval Patrick", "The.Daily.Show", 2011, 04, 12)] [TestCase("The Daily Show - 2011-04-12 - Gov. Deval Patrick", "The.Daily.Show", 2011, 04, 12)]
[Row("2011.01.10 - Denis Leary - HD TV.mkv", "", 2011, 1, 10)] [TestCase("2011.01.10 - Denis Leary - HD TV.mkv", "", 2011, 1, 10)]
[Row("2011.03.13 - Denis Leary - HD TV.mkv", "", 2011, 3, 13)] [TestCase("2011.03.13 - Denis Leary - HD TV.mkv", "", 2011, 3, 13)]
public void episode_daily_parse(string postTitle, string title, int year, int month, int day) public void episode_daily_parse(string postTitle, string title, int year, int month, int day)
{ {
var result = Parser.ParseEpisodeInfo(postTitle); var result = Parser.ParseEpisodeInfo(postTitle);
@ -163,9 +164,9 @@ namespace NzbDrone.Core.Test
[Test] [Test]
[Row("30.Rock.Season.04.HDTV.XviD-DIMENSION", "30.Rock", 4)] [TestCase("30.Rock.Season.04.HDTV.XviD-DIMENSION", "30.Rock", 4)]
[Row("Parks.and.Recreation.S02.720p.x264-DIMENSION", "Parks.and.Recreation", 2)] [TestCase("Parks.and.Recreation.S02.720p.x264-DIMENSION", "Parks.and.Recreation", 2)]
[Row("The.Office.US.S03.720p.x264-DIMENSION", "The.Office.US", 3)] [TestCase("The.Office.US.S03.720p.x264-DIMENSION", "The.Office.US", 3)]
public void full_season_release_parse(string postTitle, string title, int season) public void full_season_release_parse(string postTitle, string title, int season)
{ {
var result = Parser.ParseEpisodeInfo(postTitle); var result = Parser.ParseEpisodeInfo(postTitle);
@ -175,11 +176,11 @@ namespace NzbDrone.Core.Test
} }
[Test] [Test]
[Row("Conan", "conan")] [TestCase("Conan", "conan")]
[Row("The Tonight Show With Jay Leno", "tonightshowwithjayleno")] [TestCase("The Tonight Show With Jay Leno", "tonightshowwithjayleno")]
[Row("The.Daily.Show", "dailyshow")] [TestCase("The.Daily.Show", "dailyshow")]
[Row("Castle (2009)", "castle2009")] [TestCase("Castle (2009)", "castle2009")]
[Row("Parenthood.2010", "parenthood2010")] [TestCase("Parenthood.2010", "parenthood2010")]
public void series_name_normalize(string parsedSeriesName, string seriesName) public void series_name_normalize(string parsedSeriesName, string seriesName)
{ {
var result = Parser.NormalizeTitle(parsedSeriesName); var result = Parser.NormalizeTitle(parsedSeriesName);
@ -187,11 +188,11 @@ namespace NzbDrone.Core.Test
} }
[Test] [Test]
[Row(@"c:\test\", @"c:\test")] [TestCase(@"c:\test\", @"c:\test")]
[Row(@"c:\\test\\", @"c:\test")] [TestCase(@"c:\\test\\", @"c:\test")]
[Row(@"C:\\Test\\", @"C:\Test")] [TestCase(@"C:\\Test\\", @"C:\Test")]
[Row(@"C:\\Test\\Test\", @"C:\Test\Test")] [TestCase(@"C:\\Test\\Test\", @"C:\Test\Test")]
[Row(@"\\Testserver\Test\", @"\\Testserver\Test")] [TestCase(@"\\Testserver\Test\", @"\\Testserver\Test")]
public void Normalize_Path(string dirty, string clean) public void Normalize_Path(string dirty, string clean)
{ {
var result = Parser.NormalizePath(dirty); var result = Parser.NormalizePath(dirty);
@ -199,9 +200,9 @@ namespace NzbDrone.Core.Test
} }
[Test] [Test]
[Row("CaPitAl", "capital")] [TestCase("CaPitAl", "capital")]
[Row("peri.od", "period")] [TestCase("peri.od", "period")]
[Row("this.^&%^**$%@#$!That", "thisthat")] [TestCase("this.^&%^**$%@#$!That", "thisthat")]
public void Normalize_Title(string dirty, string clean) public void Normalize_Title(string dirty, string clean)
{ {
var result = Parser.NormalizeTitle(dirty); var result = Parser.NormalizeTitle(dirty);
@ -209,12 +210,12 @@ namespace NzbDrone.Core.Test
} }
[Test] [Test]
[Row("the")] [TestCase("the")]
[Row("and")] [TestCase("and")]
[Row("or")] [TestCase("or")]
[Row("a")] [TestCase("a")]
[Row("an")] [TestCase("an")]
[Row("of")] [TestCase("of")]
public void Normalize_removed_common_words(string word) public void Normalize_removed_common_words(string word)
{ {
var dirtyFormat = new[] var dirtyFormat = new[]
@ -239,12 +240,12 @@ namespace NzbDrone.Core.Test
} }
[Test] [Test]
[Row("the")] [TestCase("the")]
[Row("and")] [TestCase("and")]
[Row("or")] [TestCase("or")]
[Row("a")] [TestCase("a")]
[Row("an")] [TestCase("an")]
[Row("of")] [TestCase("of")]
public void Normalize_not_removed_common_words_in_the_middle(string word) public void Normalize_not_removed_common_words_in_the_middle(string word)
{ {
var dirtyFormat = new[] var dirtyFormat = new[]

@ -3,7 +3,8 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using MbUnit.Framework; using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
@ -64,7 +65,8 @@ namespace NzbDrone.Core.Test
var result = repo.All<Series>(); var result = repo.All<Series>();
Assert.Count(1, result);
result.Should().HaveCount(1);
Assert.AreEqual(result.ToList()[0].QualityProfile.Name, testProfile.Name); Assert.AreEqual(result.ToList()[0].QualityProfile.Name, testProfile.Name);
//Act //Act

@ -1,9 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using Gallio.Framework; using FluentAssertions;
using MbUnit.Framework; using NUnit.Framework;
using MbUnit.Framework.ContractVerifiers;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
using NzbDrone.Core.Repository.Quality; using NzbDrone.Core.Repository.Quality;
@ -14,39 +13,43 @@ namespace NzbDrone.Core.Test
public class QualityTest public class QualityTest
{ {
[Test] [Test]
[Ignore("No supported asserts are available")]
public void Icomparer_greater_test() public void Icomparer_greater_test()
{ {
var first = new Quality(QualityTypes.DVD, true); var first = new Quality(QualityTypes.DVD, true);
var second = new Quality(QualityTypes.Bluray1080p, true); var second = new Quality(QualityTypes.Bluray1080p, true);
Assert.GreaterThan(second, first); //Assert.GreaterThan(second, first);
} }
[Test] [Test]
[Ignore("No supported asserts are available")]
public void Icomparer_greater_proper() public void Icomparer_greater_proper()
{ {
var first = new Quality(QualityTypes.Bluray1080p, false); var first = new Quality(QualityTypes.Bluray1080p, false);
var second = new Quality(QualityTypes.Bluray1080p, true); var second = new Quality(QualityTypes.Bluray1080p, true);
Assert.GreaterThan(second, first); //Assert.GreaterThan(second, first);
} }
[Test] [Test]
[Ignore("No supported asserts are available")]
public void Icomparer_lesser() public void Icomparer_lesser()
{ {
var first = new Quality(QualityTypes.DVD, true); var first = new Quality(QualityTypes.DVD, true);
var second = new Quality(QualityTypes.Bluray1080p, true); var second = new Quality(QualityTypes.Bluray1080p, true);
Assert.LessThan(first, second); //Assert.LessThan(first, second);
} }
[Test] [Test]
[Ignore("No supported asserts are available")]
public void Icomparer_lesser_proper() public void Icomparer_lesser_proper()
{ {
var first = new Quality(QualityTypes.DVD, false); var first = new Quality(QualityTypes.DVD, false);
var second = new Quality(QualityTypes.DVD, true); var second = new Quality(QualityTypes.DVD, true);
Assert.LessThan(first, second); //Assert.LessThan(first, second);
} }
[Test] [Test]

@ -2,9 +2,10 @@
using System; using System;
using System.Linq; using System.Linq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using MbUnit.Framework; using FluentAssertions;
using NLog; using NLog;
using NLog.Config; using NLog.Config;
using NUnit.Framework;
using NzbDrone.Core.Instrumentation; using NzbDrone.Core.Instrumentation;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
@ -33,7 +34,8 @@ namespace NzbDrone.Core.Test
Assert.AreEqual(fakeSeries.SeriesId, fetchedSeries.SeriesId); Assert.AreEqual(fakeSeries.SeriesId, fetchedSeries.SeriesId);
Assert.AreEqual(fakeSeries.Title, fetchedSeries.Title); Assert.AreEqual(fakeSeries.Title, fetchedSeries.Title);
Assert.IsNotEmpty(fetchedSeries.Episodes);
fetchedSeries.Episodes.Should().HaveCount(1);
Assert.AreEqual(fetchedSeries.Episodes[0].EpisodeId, fakeEpisode.EpisodeId); Assert.AreEqual(fetchedSeries.Episodes[0].EpisodeId, fakeEpisode.EpisodeId);
Assert.AreEqual(fetchedSeries.Episodes[0].SeriesId, fakeEpisode.SeriesId); Assert.AreEqual(fetchedSeries.Episodes[0].SeriesId, fakeEpisode.SeriesId);
Assert.AreEqual(fetchedSeries.Episodes[0].Title, fakeEpisode.Title); Assert.AreEqual(fetchedSeries.Episodes[0].Title, fakeEpisode.Title);
@ -60,9 +62,9 @@ namespace NzbDrone.Core.Test
Assert.AreEqual(fakeEpisode.Title, fetchedEpisode.Title); Assert.AreEqual(fakeEpisode.Title, fetchedEpisode.Title);
Console.WriteLine("======================="); Console.WriteLine("=======================");
var ttt= fetchedEpisode.Series; var ttt = fetchedEpisode.Series;
Console.WriteLine("======================="); Console.WriteLine("=======================");
var tttd= fetchedEpisode.Series; var tttd = fetchedEpisode.Series;
Console.WriteLine("======================="); Console.WriteLine("=======================");
//Assert.Contains(fetchedEpisode.ToString(), fakeSeries.Title); //Assert.Contains(fetchedEpisode.ToString(), fakeSeries.Title);
@ -73,20 +75,20 @@ namespace NzbDrone.Core.Test
[Description( [Description(
"This test confirms that the tvdb id stored in the db is preserved rather than being replaced by an auto incrementing value" "This test confirms that the tvdb id stored in the db is preserved rather than being replaced by an auto incrementing value"
)] )]
public void tvdbid_is_preserved([RandomNumbers(Minimum = 100, Maximum = 999, Count = 1)] int tvdbId) public void tvdbid_is_preserved()
{ {
//Arrange //Arrange
var sonicRepo = MockLib.GetEmptyRepository(); var sonicRepo = MockLib.GetEmptyRepository();
var series = Builder<Series>.CreateNew().With(c => c.SeriesId = tvdbId).Build(); var series = Builder<Series>.CreateNew().With(c => c.SeriesId = 18).Build();
//Act //Act
var addId = sonicRepo.Add(series); var addId = sonicRepo.Add(series);
//Assert //Assert
Assert.AreEqual(tvdbId, addId); Assert.AreEqual(18, addId);
var allSeries = sonicRepo.All<Series>(); var allSeries = sonicRepo.All<Series>();
Assert.IsNotEmpty(allSeries); allSeries.Should().HaveCount(1);
Assert.AreEqual(tvdbId, allSeries.First().SeriesId); Assert.AreEqual(18, allSeries.First().SeriesId);
} }
[Test] [Test]
@ -118,8 +120,7 @@ namespace NzbDrone.Core.Test
Logger.Info(message); Logger.Info(message);
//Assert //Assert
Assert.IsNotEmpty(sonicRepo.All<Log>()); sonicRepo.All<Log>().Should().HaveCount(1);
Assert.Count(1, sonicRepo.All<Log>());
var logItem = sonicRepo.All<Log>().First(); var logItem = sonicRepo.All<Log>().First();
Assert.AreNotEqual(new DateTime(), logItem.Time); Assert.AreNotEqual(new DateTime(), logItem.Time);
@ -153,8 +154,7 @@ namespace NzbDrone.Core.Test
Logger.ErrorException(message, ex); Logger.ErrorException(message, ex);
//Assert //Assert
Assert.IsNotEmpty(sonicRepo.All<Log>()); sonicRepo.All<Log>().Should().HaveCount(1);
Assert.Count(1, sonicRepo.All<Log>());
var logItem = sonicRepo.All<Log>().First(); var logItem = sonicRepo.All<Log>().First();
Assert.AreNotEqual(new DateTime(), logItem.Time); Assert.AreNotEqual(new DateTime(), logItem.Time);
@ -187,8 +187,7 @@ namespace NzbDrone.Core.Test
Logger.ErrorException(message, ex); Logger.ErrorException(message, ex);
//Assert //Assert
Assert.IsNotEmpty(sonicRepo.All<Log>()); sonicRepo.All<Log>().Should().HaveCount(1);
Assert.Count(1, sonicRepo.All<Log>());
var logItem = sonicRepo.All<Log>().First(); var logItem = sonicRepo.All<Log>().First();
Assert.AreNotEqual(new DateTime(), logItem.Time); Assert.AreNotEqual(new DateTime(), logItem.Time);

@ -2,11 +2,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Text; using System.Text;
using Gallio.Framework; using FluentAssertions;
using MbUnit.Framework;
using MbUnit.Framework.ContractVerifiers;
using Migrator.Framework; using Migrator.Framework;
using Migrator.Providers.SQLite; using Migrator.Providers.SQLite;
using NUnit.Framework;
using NzbDrone.Core.Datastore; using NzbDrone.Core.Datastore;
using NzbDrone.Core.Instrumentation; using NzbDrone.Core.Instrumentation;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
@ -29,21 +28,22 @@ namespace NzbDrone.Core.Test
var provider = new RepositoryProvider(); var provider = new RepositoryProvider();
var types = provider.GetRepositoryTypes(); var types = provider.GetRepositoryTypes();
Assert.IsNotEmpty(types); types.Should().Contain(typeof(Config));
Assert.Contains(types, typeof(Config)); types.Should().Contain(typeof(Episode));
Assert.Contains(types, typeof(Episode)); types.Should().Contain(typeof(EpisodeFile));
Assert.Contains(types, typeof(EpisodeFile)); types.Should().Contain(typeof(ExternalNotificationSetting));
Assert.Contains(types, typeof(ExternalNotificationSetting)); types.Should().Contain(typeof(History));
Assert.Contains(types, typeof(History)); types.Should().Contain(typeof(IndexerSetting));
Assert.Contains(types, typeof(IndexerSetting)); types.Should().Contain(typeof(JobSetting));
Assert.Contains(types, typeof(JobSetting)); types.Should().Contain(typeof(RootDir));
Assert.Contains(types, typeof(RootDir)); types.Should().Contain(typeof(Season));
Assert.Contains(types, typeof(Season)); types.Should().Contain(typeof(Season));
Assert.Contains(types, typeof(Series)); types.Should().Contain(typeof(Series));
types.Should().Contain(typeof(QualityProfile));
Assert.Contains(types, typeof(QualityProfile));
types.Should().NotContain(typeof(QualityTypes));
Assert.DoesNotContain(types, typeof(QualityTypes));
} }
@ -57,7 +57,8 @@ namespace NzbDrone.Core.Test
var typeTable = provider.GetSchemaFromType(typeof(TestRepoType)); var typeTable = provider.GetSchemaFromType(typeof(TestRepoType));
Assert.IsNotNull(typeTable.Columns); Assert.IsNotNull(typeTable.Columns);
Assert.Count(3, typeTable.Columns);
typeTable.Columns.Should().HaveCount(3);
Assert.AreEqual("TestRepoTypes", typeTable.Name); Assert.AreEqual("TestRepoTypes", typeTable.Name);
} }
@ -89,12 +90,12 @@ namespace NzbDrone.Core.Test
var repo = new SimpleRepository(dbProvider, SimpleRepositoryOptions.RunMigrations); var repo = new SimpleRepository(dbProvider, SimpleRepositoryOptions.RunMigrations);
var sqliteDatabase = new SQLiteTransformationProvider(new SQLiteDialect(), connectionString); var sqliteDatabase = new SQLiteTransformationProvider(new SQLiteDialect(), connectionString);
repo.Add(new TestRepoType(){Value = "Dummy"}); repo.Add(new TestRepoType() { Value = "Dummy" });
var repositoryProvider = new RepositoryProvider(); var repositoryProvider = new RepositoryProvider();
var columns = repositoryProvider.GetColumnsFromDatabase(sqliteDatabase, "TestRepoTypes"); var columns = repositoryProvider.GetColumnsFromDatabase(sqliteDatabase, "TestRepoTypes");
Assert.Count(3, columns); columns.Should().HaveCount(3);
} }
@ -107,7 +108,7 @@ namespace NzbDrone.Core.Test
var sqliteDatabase = new SQLiteTransformationProvider(new SQLiteDialect(), connectionString); var sqliteDatabase = new SQLiteTransformationProvider(new SQLiteDialect(), connectionString);
var repo = new SimpleRepository(dbProvider, SimpleRepositoryOptions.RunMigrations); var repo = new SimpleRepository(dbProvider, SimpleRepositoryOptions.RunMigrations);
repo.Add(new TestRepoType(){Value = "Dummy"}); repo.Add(new TestRepoType() { Value = "Dummy" });
var repositoryProvider = new RepositoryProvider(); var repositoryProvider = new RepositoryProvider();
var typeSchema = repositoryProvider.GetSchemaFromType(typeof(TestRepoType2)); var typeSchema = repositoryProvider.GetSchemaFromType(typeof(TestRepoType2));
@ -117,7 +118,7 @@ namespace NzbDrone.Core.Test
var deletedColumns = repositoryProvider.GetDeletedColumns(typeSchema, columns); var deletedColumns = repositoryProvider.GetDeletedColumns(typeSchema, columns);
Assert.Count(1, deletedColumns); deletedColumns.Should().HaveCount(1);
Assert.AreEqual("NewName", deletedColumns[0].Name.Trim('[', ']')); Assert.AreEqual("NewName", deletedColumns[0].Name.Trim('[', ']'));
} }
@ -135,12 +136,12 @@ namespace NzbDrone.Core.Test
var repositoryProvider = new RepositoryProvider(); var repositoryProvider = new RepositoryProvider();
var typeSchema = repositoryProvider.GetSchemaFromType(typeof(TestRepoType)); var typeSchema = repositoryProvider.GetSchemaFromType(typeof(TestRepoType));
var columns = repositoryProvider.GetColumnsFromDatabase(sqliteDatabase, "TestRepoType2s"); var columns = repositoryProvider.GetColumnsFromDatabase(sqliteDatabase, "TestRepoType2s");
var deletedColumns = repositoryProvider.GetNewColumns(typeSchema, columns); var deletedColumns = repositoryProvider.GetNewColumns(typeSchema, columns);
Assert.Count(1, deletedColumns); deletedColumns.Should().HaveCount(1);
Assert.AreEqual("NewName", deletedColumns[0].Name.Trim('[', ']')); Assert.AreEqual("NewName", deletedColumns[0].Name.Trim('[', ']'));
} }

@ -2,8 +2,9 @@
using System; using System;
using System.Linq; using System.Linq;
using AutoMoq; using AutoMoq;
using MbUnit.Framework; using FluentAssertions;
using Moq; using Moq;
using NUnit.Framework;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
@ -16,15 +17,15 @@ namespace NzbDrone.Core.Test
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
public class RootDirProviderTest : TestBase public class RootDirProviderTest : TestBase
{ {
[Test] [Test]
public void GetRootDirs() public void GetRootDirs()
{ {
//Setup //Setup
var sonicRepo = MockLib.GetEmptyRepository(); var sonicRepo = MockLib.GetEmptyRepository();
sonicRepo.Add(new RootDir {Path = @"C:\TV"}); sonicRepo.Add(new RootDir { Path = @"C:\TV" });
sonicRepo.Add(new RootDir {Path = @"C:\TV2"}); sonicRepo.Add(new RootDir { Path = @"C:\TV2" });
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
@ -50,13 +51,14 @@ namespace NzbDrone.Core.Test
//Act //Act
var rootDirProvider = mocker.Resolve<RootDirProvider>(); var rootDirProvider = mocker.Resolve<RootDirProvider>();
rootDirProvider.Add(new RootDir {Path = path}); rootDirProvider.Add(new RootDir { Path = path });
//Assert //Assert
var rootDirs = rootDirProvider.GetAll(); var rootDirs = rootDirProvider.GetAll();
Assert.IsNotEmpty(rootDirs); Assert.IsNotEmpty(rootDirs);
Assert.Count(1, rootDirs);
rootDirs.Should().HaveCount(1);
Assert.AreEqual(path, rootDirs.First().Path); Assert.AreEqual(path, rootDirs.First().Path);
} }
@ -71,13 +73,13 @@ namespace NzbDrone.Core.Test
//Act //Act
var rootDirProvider = mocker.Resolve<RootDirProvider>(); var rootDirProvider = mocker.Resolve<RootDirProvider>();
rootDirProvider.Add(new RootDir {Path = @"C:\TV"}); rootDirProvider.Add(new RootDir { Path = @"C:\TV" });
rootDirProvider.Update(new RootDir {Id = 1, Path = path}); rootDirProvider.Update(new RootDir { Id = 1, Path = path });
//Assert //Assert
var rootDirs = rootDirProvider.GetAll(); var rootDirs = rootDirProvider.GetAll();
Assert.IsNotEmpty(rootDirs); Assert.IsNotEmpty(rootDirs);
Assert.Count(1, rootDirs); rootDirs.Should().HaveCount(1);
Assert.AreEqual(path, rootDirs.First().Path); Assert.AreEqual(path, rootDirs.First().Path);
} }
@ -90,12 +92,12 @@ namespace NzbDrone.Core.Test
//Act //Act
var rootDirProvider = mocker.Resolve<RootDirProvider>(); var rootDirProvider = mocker.Resolve<RootDirProvider>();
rootDirProvider.Add(new RootDir {Path = @"C:\TV"}); rootDirProvider.Add(new RootDir { Path = @"C:\TV" });
rootDirProvider.Remove(1); rootDirProvider.Remove(1);
//Assert //Assert
var rootDirs = rootDirProvider.GetAll(); var rootDirs = rootDirProvider.GetAll();
Assert.Count(0, rootDirs); rootDirs.Should().BeEmpty();
} }
[Test] [Test]
@ -110,7 +112,7 @@ namespace NzbDrone.Core.Test
//Act //Act
var rootDirProvider = mocker.Resolve<RootDirProvider>(); var rootDirProvider = mocker.Resolve<RootDirProvider>();
rootDirProvider.Add(new RootDir {Id = id, Path = path}); rootDirProvider.Add(new RootDir { Id = id, Path = path });
//Assert //Assert
var rootDir = rootDirProvider.GetRootDir(id); var rootDir = rootDirProvider.GetRootDir(id);

@ -5,8 +5,8 @@ using System.IO;
using System.Linq; using System.Linq;
using AutoMoq; using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using MbUnit.Framework;
using Moq; using Moq;
using NUnit.Framework;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.Core;
@ -179,7 +179,7 @@ namespace NzbDrone.Core.Test
} }
[Test] [Test]
[ExpectedException(typeof(ApplicationException), Message = "API Key Incorrect")] [ExpectedException(typeof(ApplicationException), ExpectedMessage= "API Key Incorrect")]
public void IsInQueue_False_Error() public void IsInQueue_False_Error()
{ {
//Setup //Setup
@ -213,12 +213,12 @@ namespace NzbDrone.Core.Test
} }
[Test] [Test]
[Row(1, new[] { 2 }, "My Episode Title", QualityTypes.DVD, false, "My Series Name - 1x2 - My Episode Title [DVD]")] [TestCase(1, new[] { 2 }, "My Episode Title", QualityTypes.DVD, false, "My Series Name - 1x2 - My Episode Title [DVD]")]
[Row(1, new[] { 2 }, "My Episode Title", QualityTypes.DVD, true, "My Series Name - 1x2 - My Episode Title [DVD] [Proper]")] [TestCase(1, new[] { 2 }, "My Episode Title", QualityTypes.DVD, true, "My Series Name - 1x2 - My Episode Title [DVD] [Proper]")]
[Row(1, new[] { 2 }, "", QualityTypes.DVD, true, "My Series Name - 1x2 - [DVD] [Proper]")] [TestCase(1, new[] { 2 }, "", QualityTypes.DVD, true, "My Series Name - 1x2 - [DVD] [Proper]")]
[Row(1, new[] { 2, 4 }, "My Episode Title", QualityTypes.HDTV, false, "My Series Name - 1x2-1x4 - My Episode Title [HDTV]")] [TestCase(1, new[] { 2, 4 }, "My Episode Title", QualityTypes.HDTV, false, "My Series Name - 1x2-1x4 - My Episode Title [HDTV]")]
[Row(1, new[] { 2, 4 }, "My Episode Title", QualityTypes.HDTV, true, "My Series Name - 1x2-1x4 - My Episode Title [HDTV] [Proper]")] [TestCase(1, new[] { 2, 4 }, "My Episode Title", QualityTypes.HDTV, true, "My Series Name - 1x2-1x4 - My Episode Title [HDTV] [Proper]")]
[Row(1, new[] { 2, 4 }, "", QualityTypes.HDTV, true, "My Series Name - 1x2-1x4 - [HDTV] [Proper]")] [TestCase(1, new[] { 2, 4 }, "", QualityTypes.HDTV, true, "My Series Name - 1x2-1x4 - [HDTV] [Proper]")]
public void sab_title(int seasons, int[] episodes, string title, QualityTypes quality, bool proper, string excpected) public void sab_title(int seasons, int[] episodes, string title, QualityTypes quality, bool proper, string excpected)
{ {
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();

@ -1,57 +1,59 @@
// ReSharper disable RedundantUsingDirective // ReSharper disable RedundantUsingDirective
using System; using System;
using System.Linq; using System.Linq;
using MbUnit.Framework; using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Providers; using NzbDrone.Core.Providers;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test namespace NzbDrone.Core.Test
{ {
[TestFixture] [NUnit.Framework.TestFixture]
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
public class TvDbProviderTest : TestBase public class TvDbProviderTest : TestBase
{ {
[Test] [Test]
[Row("The Simpsons")] [TestCase("The Simpsons")]
[Row("Family Guy")] [TestCase("Family Guy")]
[Row("South Park")] [TestCase("South Park")]
[Row("clone high, usa")] [TestCase("clone high, usa")]
public void successful_search(string title) public void successful_search(string title)
{ {
var tvCont = new TvDbProvider(); var tvCont = new TvDbProvider();
var result = tvCont.SearchSeries(title); var result = tvCont.SearchSeries(title);
Assert.IsNotEmpty(result);
Assert.AreEqual(title, result[0].SeriesName, StringComparison.InvariantCultureIgnoreCase); result.Should().NotBeEmpty();
result[0].SeriesName.Should().Be(title);
} }
[Test] [Test]
[Row("The Simpsons")] [TestCase("The Simpsons")]
[Row("Family Guy")] [TestCase("Family Guy")]
[Row("South Park")] [TestCase("South Park")]
public void successful_title_lookup(string title) public void successful_title_lookup(string title)
{ {
var tvCont = new TvDbProvider(); var tvCont = new TvDbProvider();
var result = tvCont.GetSeries(title); var result = tvCont.GetSeries(title);
Assert.AreEqual(title, result.SeriesName, StringComparison.InvariantCultureIgnoreCase); result.SeriesName.Should().Be(title);
} }
[Test] [Test]
[Row(new object[] { "CAPITAL", "capital", true })] [TestCase(new object[] { "CAPITAL", "capital", true })]
[Row(new object[] { "Something!!", "Something", true })] [TestCase(new object[] { "Something!!", "Something", true })]
[Row(new object[] { "Simpsons 2000", "Simpsons", true })] [TestCase(new object[] { "Simpsons 2000", "Simpsons", true })]
[Row(new object[] { "Simp222sons", "Simpsons", true })] [TestCase(new object[] { "Simp222sons", "Simpsons", true })]
[Row(new object[] { "Simpsons", "The Simpsons", true })] [TestCase(new object[] { "Simpsons", "The Simpsons", true })]
[Row(new object[] { "Law and order", "Law & order", true })] [TestCase(new object[] { "Law and order", "Law & order", true })]
[Row(new object[] { "xxAndxx", "xxxx", false })] [TestCase(new object[] { "xxAndxx", "xxxx", false })]
[Row(new object[] { "Andxx", "xx", false })] [TestCase(new object[] { "Andxx", "xx", false })]
[Row(new object[] { "xxAnd", "xx", false })] [TestCase(new object[] { "xxAnd", "xx", false })]
[Row(new object[] { "Thexx", "xx", false })] [TestCase(new object[] { "Thexx", "xx", false })]
[Row(new object[] { "Thexx", "xx", false })] [TestCase(new object[] { "Thexx", "xx", false })]
[Row(new object[] { "xxThexx", "xxxxx", false })] [TestCase(new object[] { "xxThexx", "xxxxx", false })]
[Row(new object[] { "Simpsons The", "Simpsons", true })] [TestCase(new object[] { "Simpsons The", "Simpsons", true })]
public void Name_match_test(string a, string b, bool match) public void Name_match_test(string a, string b, bool match)
{ {
bool result = TvDbProvider.IsTitleMatch(a, b); bool result = TvDbProvider.IsTitleMatch(a, b);
@ -69,7 +71,7 @@ namespace NzbDrone.Core.Test
var result = tvdbProvider.SearchSeries(Guid.NewGuid().ToString()); var result = tvdbProvider.SearchSeries(Guid.NewGuid().ToString());
//assert //assert
Assert.IsEmpty(result); result.Should().BeEmpty();
} }
[Test] [Test]
@ -114,19 +116,19 @@ namespace NzbDrone.Core.Test
} }
//assert //assert
Assert.Count(7, seasons); seasons.Should().HaveCount(7);
Assert.Count(23, seasons1); seasons1.Should().HaveCount(23);
Assert.Count(19, seasons2); seasons2.Should().HaveCount(19);
Assert.Count(16, seasons3); seasons3.Should().HaveCount(16);
Assert.Count(20, seasons4); seasons4.Should().HaveCount(20);
Assert.Count(18, seasons5); seasons5.Should().HaveCount(18);
Assert.Distinct(seasons1.Select(s => s.EpisodeNumber)); seasons1.Select(s => s.EpisodeNumber).Should().OnlyHaveUniqueItems();
Assert.Distinct(seasons2.Select(s => s.EpisodeNumber)); seasons2.Select(s => s.EpisodeNumber).Should().OnlyHaveUniqueItems();
Assert.Distinct(seasons3.Select(s => s.EpisodeNumber)); seasons3.Select(s => s.EpisodeNumber).Should().OnlyHaveUniqueItems();
Assert.Distinct(seasons4.Select(s => s.EpisodeNumber)); seasons4.Select(s => s.EpisodeNumber).Should().OnlyHaveUniqueItems();
Assert.Distinct(seasons5.Select(s => s.EpisodeNumber)); seasons5.Select(s => s.EpisodeNumber).Should().OnlyHaveUniqueItems();
Assert.Distinct(seasons6.Select(s => s.EpisodeNumber)); seasons6.Select(s => s.EpisodeNumber).Should().OnlyHaveUniqueItems();
} }
} }

@ -5,9 +5,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using Gallio.Framework; using NUnit.Framework;
using MbUnit.Framework;
using MbUnit.Framework.ContractVerifiers;
using NzbDrone.Core.Repository; using NzbDrone.Core.Repository;
using NzbDrone.Core.Test.Framework; using NzbDrone.Core.Test.Framework;

@ -7,5 +7,4 @@
<package id="CommonServiceLocator" version="1.0" /> <package id="CommonServiceLocator" version="1.0" />
<package id="Unity" version="2.1.505.0" /> <package id="Unity" version="2.1.505.0" />
<package id="NUnit" version="2.5.10.11092" /> <package id="NUnit" version="2.5.10.11092" />
<package id="FluentAssertions" version="1.4.0.0" />
</packages> </packages>
Loading…
Cancel
Save