1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-26 09:47:39 +00:00

Using RealDb instead of Mocked DB.

This commit is contained in:
Mark McDowall 2011-11-30 17:10:36 -08:00
parent 21601a5805
commit 4ddd1a0f6f

View file

@ -290,16 +290,12 @@ namespace NzbDrone.Core.Test.ProviderTests
public void GetEpisodeParseResult_get_daily_should_add_new_episode()
{
//Setup
WithRealDb();
var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.SeriesId = 1)
.Build();
Mocker.GetMock<IDatabase>().Setup(s => s.Fetch<Episode, Series, EpisodeFile>(It.IsAny<String>(), It.IsAny<Object[]>()))
.Returns(new List<Episode>());
Mocker.GetMock<IDatabase>().Setup(s => s.Insert(It.IsAny<Episode>()))
.Returns(1);
//Act
var episodes = Mocker.Resolve<EpisodeProvider>()
.GetEpisodesByParseResult(new EpisodeParseResult { AirDate = DateTime.Today, Series = fakeSeries }, true);
@ -308,7 +304,9 @@ namespace NzbDrone.Core.Test.ProviderTests
episodes.Should().HaveCount(1);
episodes.First().AirDate.Should().Be(DateTime.Today);
Mocker.GetMock<IDatabase>().Verify(v => v.Insert(It.IsAny<Episode>()), Times.Once());
var episodesInDb = Db.Fetch<Episode>();
episodesInDb.Should().HaveCount(1);
}
}
}