mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-30 23:42:33 +01:00
Using RealDb instead of Mocked DB.
This commit is contained in:
parent
21601a5805
commit
4ddd1a0f6f
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user