Пример #1
0
        public void GetEpisodesForSeries()
        {
            var series = (PartialViewResult)_controller.GetEpisodes(1, "stringTitle");
            var model  = (SonarrEpisodeViewModel)series.Model;

            Assert.That(model.EpisodeViewModels.Count, Is.GreaterThan(0));
            Assert.That(model.SeasonTitle, Is.EqualTo("stringTitle"));
            Assert.That(model.EpisodeViewModels[SonarrEpisode[0].seasonNumber][0].Monitored, Is.EqualTo(SonarrEpisode[0].monitored));
            Assert.That(model.EpisodeViewModels[SonarrEpisode[0].seasonNumber][0].Overview, Is.EqualTo(SonarrEpisode[0].overview));
            Assert.That(model.EpisodeViewModels[SonarrEpisode[0].seasonNumber][0].Title, Is.EqualTo(SonarrEpisode[0].title));
            Assert.That(model.EpisodeViewModels[SonarrEpisode[0].seasonNumber][0].AbsoluteEpisodeNumber, Is.EqualTo(SonarrEpisode[0].absoluteEpisodeNumber));
            Assert.That(model.EpisodeViewModels[SonarrEpisode[0].seasonNumber][0].Downloading, Is.EqualTo(SonarrEpisode[0].downloading));
            Assert.That(model.EpisodeViewModels[SonarrEpisode[0].seasonNumber][0].EpisodeFileId, Is.EqualTo(SonarrEpisode[0].episodeFileId));
            Assert.That(model.EpisodeViewModels[SonarrEpisode[0].seasonNumber][0].HasFile, Is.EqualTo(SonarrEpisode[0].hasFile));
            Assert.That(model.EpisodeViewModels[SonarrEpisode[0].seasonNumber][0].ID, Is.EqualTo(SonarrEpisode[0].id));
            Assert.That(model.EpisodeViewModels[SonarrEpisode[0].seasonNumber][0].SeasonNumber, Is.EqualTo(SonarrEpisode[0].seasonNumber));


            ServiceMock.Verify(x => x.GetSonarrEpisodes(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>()), Times.Once);
            SettingsMock.Verify(x => x.GetSettings(), Times.Once);
        }
Пример #2
0
        public void GetSeries()
        {
            var series = (PartialViewResult)_controller.GetSeries();
            var model  = (List <SonarrSeriesViewModel>)series.Model;

            DateTime newDate;

            DateTime.TryParse(SonarrSeries[0].firstAired, out newDate);


            Assert.That(model.Count, Is.GreaterThan(0));
            Assert.That(model[0].Id, Is.EqualTo(SonarrSeries[0].id));
            Assert.That(model[0].ImdbId, Is.EqualTo(SonarrSeries[0].imdbId));
            Assert.That(model[0].Monitored, Is.EqualTo(SonarrSeries[0].monitored));
            Assert.That(model[0].FirstAired, Is.EqualTo(newDate.ToString("D")));
            Assert.That(model[0].EpisodeCount, Is.EqualTo(SonarrSeries[0].episodeCount));
            Assert.That(model[0].CleanTitle, Is.EqualTo(SonarrSeries[0].cleanTitle));
            Assert.That(model[0].AirTime, Is.EqualTo(SonarrSeries[0].airTime));
            Assert.That(model[0].Network, Is.EqualTo(SonarrSeries[0].network));
            Assert.That(model[0].NextAiring, Is.EqualTo(SonarrSeries[0].nextAiring));
            Assert.That(model[0].Overview, Is.EqualTo(SonarrSeries[0].overview));
            Assert.That(model[0].Path, Is.EqualTo(SonarrSeries[0].path));
            Assert.That(model[0].QualityProfileId, Is.EqualTo(SonarrSeries[0].qualityProfileId));
            Assert.That(model[0].Runtime, Is.EqualTo(SonarrSeries[0].runtime));
            Assert.That(model[0].SeasonCount, Is.EqualTo(SonarrSeries[0].seasonCount));
            Assert.That(model[0].SeasonFolder, Is.EqualTo(SonarrSeries[0].seasonFolder));
            Assert.That(model[0].SeriesType, Is.EqualTo(SonarrSeries[0].seriesType));
            Assert.That(model[0].Status, Is.EqualTo(SonarrSeries[0].status));
            Assert.That(model[0].Title, Is.EqualTo(SonarrSeries[0].title));
            Assert.That(model[0].TitleSlug, Is.EqualTo(SonarrSeries[0].titleSlug));
            Assert.That(model[0].Year, Is.EqualTo(SonarrSeries[0].year));
            Assert.That(model[0].ImageUrls[0], Is.EqualTo(UrlHelper.ReturnUri(ExpectedSettings.IpAddress, ExpectedSettings.Port) + SonarrSeries[0].images[0].url));

            ServiceMock.Verify(x => x.GetSonarrSeries(It.IsAny <string>(), It.IsAny <string>()), Times.Once);
            SettingsMock.Verify(x => x.GetSettings(), Times.Once);
        }
 public void Teardown()
 {
     SettingsMock.Verify(x => x.GetSettings(), Times.Once);
     JobMock.Verify(x => x.Record(It.IsAny <string>()), Times.Once());
 }