mirror of https://github.com/Radarr/Radarr
fixed broken test
This commit is contained in:
parent
e4ff0d6471
commit
4d442ba1e5
|
@ -29,9 +29,9 @@ namespace NzbDrone.Core.Test
|
||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
|
|
||||||
//Constants
|
//Constants
|
||||||
const string fileName = @"WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi";
|
const string fileName = @"WEEDS.S03E01.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi";
|
||||||
const int seasonNumber = 3;
|
const int seasonNumber = 3;
|
||||||
const int episodeNumner = 01;
|
const int episodeNumner = 1;
|
||||||
const int size = 12345;
|
const int size = 12345;
|
||||||
|
|
||||||
//Fakes
|
//Fakes
|
||||||
|
@ -41,17 +41,19 @@ namespace NzbDrone.Core.Test
|
||||||
//Mocks
|
//Mocks
|
||||||
var mocker = new AutoMoqer();
|
var mocker = new AutoMoqer();
|
||||||
|
|
||||||
|
mocker.GetMock<DiskProvider>()
|
||||||
|
.Setup(e => e.GetSize(fileName)).Returns(12345).Verifiable();
|
||||||
|
|
||||||
mocker.GetMock<IRepository>()
|
mocker.GetMock<IRepository>()
|
||||||
.Setup(r => r.Exists(It.IsAny<Expression<Func<EpisodeFile, Boolean>>>())).Returns(false).Verifiable();
|
.Setup(r => r.Exists(It.IsAny<Expression<Func<EpisodeFile, Boolean>>>())).Returns(false).Verifiable();
|
||||||
|
|
||||||
mocker.GetMock<IRepository>()
|
mocker.GetMock<IRepository>()
|
||||||
.Setup(r => r.Add(It.IsAny<EpisodeFile>())).Returns(0).Verifiable();
|
.Setup(r => r.Add(It.IsAny<EpisodeFile>())).Returns(0).Verifiable();
|
||||||
|
|
||||||
mocker.GetMock<EpisodeProvider>()
|
mocker.GetMock<EpisodeProvider>()
|
||||||
.Setup(e => e.GetEpisode(fakeSeries.SeriesId, seasonNumber, episodeNumner)).Returns(fakeEpisode).
|
.Setup(e => e.GetEpisode(fakeSeries.SeriesId, seasonNumber, episodeNumner)).Returns(fakeEpisode);
|
||||||
Verifiable();
|
|
||||||
|
|
||||||
mocker.GetMock<DiskProvider>()
|
|
||||||
.Setup(e => e.GetSize(fileName)).Returns(12345).Verifiable();
|
|
||||||
|
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
|
@ -59,14 +61,8 @@ namespace NzbDrone.Core.Test
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
Assert.IsNotNull(result);
|
Assert.IsNotNull(result);
|
||||||
mocker.GetMock<IRepository>().VerifyAll();
|
|
||||||
mocker.GetMock<IRepository>().Verify(r => r.Add(result), Times.Once());
|
mocker.GetMock<IRepository>().Verify(r => r.Add(result), Times.Once());
|
||||||
mocker.GetMock<EpisodeProvider>().VerifyAll();
|
mocker.VerifyAllMocks();
|
||||||
mocker.GetMock<DiskProvider>().VerifyAll();
|
|
||||||
|
|
||||||
//Currently can't verify this since the list of episodes are loaded
|
|
||||||
//Dynamically by SubSonic
|
|
||||||
//Assert.AreEqual(fakeEpisode, result.Episodes[0]);
|
|
||||||
|
|
||||||
Assert.AreEqual(fakeEpisode.SeriesId, result.SeriesId);
|
Assert.AreEqual(fakeEpisode.SeriesId, result.SeriesId);
|
||||||
Assert.AreEqual(QualityTypes.BDRip, result.Quality);
|
Assert.AreEqual(QualityTypes.BDRip, result.Quality);
|
||||||
|
|
Loading…
Reference in New Issue