public void GenerateDescription_UpdatesEpisodeNumber() { var testdata = fixture.Create <List <Episode> >(); var mockLoadData = fixture.Freeze <Mock <ILoadData> >(); mockLoadData.Setup(ld => ld.Execute()).Returns(testdata); var mockEpisodeNumber = fixture.Freeze <Mock <IEpisodeNumberHelper> >(); mockEpisodeNumber.Setup(en => en.GetLastEpisodeNumber()).Returns(1); sut = fixture.Create <SimpleEngine>(); sut.LoadData(); sut.GenerateDescription(); mockEpisodeNumber.Verify(en => en.UpdateLastEpisodeNumber(testdata.Count + 1)); }
public void GenerateDescription_UpdatesEpisodeNumber_WrongValueRemovesUpdate() { var testdata = fixture.Create <List <Episode> >(); var mockLoadData = fixture.Freeze <Mock <ILoadData> >(); mockLoadData.Setup(ld => ld.Execute()).Returns(testdata); var mockEpisodeNumber = fixture.Freeze <Mock <IEpisodeNumberHelper> >(); mockEpisodeNumber.Setup(en => en.GetLastEpisodeNumber()).Returns(0); sut = fixture.Create <SimpleEngine>(); sut.LoadData(); sut.GenerateDescription(); mockEpisodeNumber.Verify(en => en.UpdateLastEpisodeNumber(It.IsAny <int>()), Times.Never); }
public void GenerateDescription_CreatesDescriptionAndSavesChanges() { var testdata = fixture.Create <List <Episode> >(); var mockLoadData = fixture.Freeze <Mock <ILoadData> >(); mockLoadData.Setup(ld => ld.Execute()).Returns(testdata); var mockYoutubeDesc = fixture.Freeze <Mock <IYouTubeDescriptionGenerator> >(); sut = fixture.Create <SimpleEngine>(); sut.LoadData(); sut.GenerateDescription(); mockYoutubeDesc.Verify(yt => yt.CreateEpisodesDescription(testdata), Times.Once); mockYoutubeDesc.Verify(yt => yt.Save(), Times.Once); }