1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-28 02:27:13 +00:00

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

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

View file

@ -112,16 +112,16 @@ public void episode_multipart_parse(string postTitle, string title, int season,
[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 - 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.03.13 - Denis Leary - HD TV.mkv", 2011, 3, 13)]
[Row("2011-03-13 - Denis Leary - HD TV.mkv", 2011, 3, 13)]
[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)]
public void episode_daily_parse(string postTitle, string title, int year, int month, int day)
{
var result = Parser.ParseEpisodeInfo(postTitle);
var airDate = new DateTime(year, month, day);
Assert.AreEqual(Parser.NormalizeTitle(title), result.CleanTitle);
Assert.AreEqual(airDate, result.AirDate);
Assert.IsEmpty(result.Episodes);
Assert.IsNull(result.Episodes);
}
[Test]