fixed broken tests

This commit is contained in:
kay.one 2011-04-25 17:43:34 -07:00
parent 17c8b8803b
commit 72e8b3ce7d
2 changed files with 11 additions and 11 deletions

View File

@ -224,18 +224,17 @@ namespace NzbDrone.Core.Test
mocker.GetMock<IRepository>(MockBehavior.Strict) mocker.GetMock<IRepository>(MockBehavior.Strict)
.Setup(r => r.Exists(It.IsAny<Expression<Func<EpisodeFile, Boolean>>>())).Returns(true).Verifiable(); .Setup(r => r.Exists(It.IsAny<Expression<Func<EpisodeFile, Boolean>>>())).Returns(true).Verifiable();
mocker.GetMock<EpisodeProvider>(MockBehavior.Strict); mocker.GetMock<EpisodeProvider>(MockBehavior.Strict);
mocker.GetMock<DiskProvider>(MockBehavior.Strict); mocker.GetMock<DiskProvider>()
.Setup(e => e.GetSize(fileName)).Returns(500000).Verifiable();
//Act //Act
var result = mocker.Resolve<MediaFileProvider>().ImportFile(fakeSeries, fileName); var result = mocker.Resolve<MediaFileProvider>().ImportFile(fakeSeries, fileName);
//Assert //Assert
mocker.GetMock<IRepository>().VerifyAll();
mocker.GetMock<EpisodeProvider>().VerifyAll();
mocker.GetMock<DiskProvider>(MockBehavior.Strict).VerifyAll();
Assert.IsNull(result); Assert.IsNull(result);
mocker.GetMock<IRepository>().Verify(r => r.Add(result), Times.Never()); mocker.GetMock<IRepository>().Verify(r => r.Add(result), Times.Never());
mocker.VerifyAllMocks();
} }
[Test] [Test]
@ -262,7 +261,8 @@ namespace NzbDrone.Core.Test
.Setup(e => e.GetEpisode(fakeSeries.SeriesId, seasonNumber, episodeNumner)).Returns<Episode>(null). .Setup(e => e.GetEpisode(fakeSeries.SeriesId, seasonNumber, episodeNumner)).Returns<Episode>(null).
Verifiable(); Verifiable();
mocker.GetMock<DiskProvider>(MockBehavior.Strict); mocker.GetMock<DiskProvider>(MockBehavior.Strict)
.Setup(e => e.GetSize(fileName)).Returns(90000000000);
//Act //Act

View File

@ -112,16 +112,16 @@ namespace NzbDrone.Core.Test
[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)] [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)]
[Row("The.Daily.Show.2010.10.11.Johnny.Knoxville.iTouch-MW", "The.Daily.Show", 2010, 10, 11)] [Row("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)] [Row("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)] [Row("2011.01.10 - Denis Leary - HD TV.mkv","", 2011, 1, 10)]
[Row("2011.03.13 - Denis Leary - HD TV.mkv", 2011, 3, 13)] [Row("2011.03.13 - Denis Leary - HD TV.mkv", "", 2011, 3, 13)]
[Row("2011-03-13 - Denis Leary - HD TV.mkv", 2011, 3, 13)] [Row("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);
var airDate = new DateTime(year, month, day); var airDate = new DateTime(year, month, day);
Assert.AreEqual(Parser.NormalizeTitle(title), result.CleanTitle); Assert.AreEqual(Parser.NormalizeTitle(title), result.CleanTitle);
Assert.AreEqual(airDate, result.AirDate); Assert.AreEqual(airDate, result.AirDate);
Assert.IsEmpty(result.Episodes); Assert.IsNull(result.Episodes);
} }
[Test] [Test]