public async Task GetEpisodesAsync_Should_Return_Episode_By_Given_PodcastId_And_EpisodeId() { EpisodeClientMock episodeClientMock = EpisodeClientMock.Create(); episodeClientMock.RestApiClientMock .Setup(client => client.GetApiResponseAsync <Episode>( It.IsAny <string>(), It.IsAny <IList <KeyValuePair <string, string> > >(), It.IsAny <IDictionary <string, string> >())) .ReturnsAsync(() => new ApiResponse <Episode>() { Model = new Episode() }); Episode episode = await episodeClientMock.GetEpisodeByIdAsync(PodcastId, EpisodeId); episodeClientMock.RestApiClientMock.Verify(client => client.GetApiResponseAsync <Episode>( It.Is <string>(url => url == EpisodesByIdUrl), It.Is <IList <KeyValuePair <string, string> > >(keyValues => keyValues == null), It.Is <IDictionary <string, string> >(keyValues => keyValues == null)), Times.Once); Assert.NotNull(episode); }
public async Task GetEpisodesResponseAsync_Should_Return_ApiResponse_With_List_Of_Episodes_By_Given_PodcastId() { EpisodeClientMock episodeClientMock = EpisodeClientMock.Create(); episodeClientMock.RestApiClientMock .Setup(client => client.GetApiResponseAsync <List <Episode> >( It.IsAny <string>(), It.IsAny <IList <KeyValuePair <string, string> > >(), It.IsAny <IDictionary <string, string> >())) .ReturnsAsync(() => new ApiResponse <List <Episode> >() { Model = new List <Episode>() }); ApiResponse <List <Episode> > apiResponse = await episodeClientMock.GetEpisodesResponseAsync(PodcastId); episodeClientMock.RestApiClientMock.Verify(client => client.GetApiResponseAsync <List <Episode> >( It.Is <string>(url => url == EpisodesUrl), It.Is <IList <KeyValuePair <string, string> > >(keyValues => keyValues == null), It.Is <IDictionary <string, string> >(keyValues => keyValues == null)), Times.Once); Assert.NotNull(apiResponse); Assert.NotNull(apiResponse.Model); }
public async Task GetEpisodeByIdResponseAsync_Should_Throw_ArgumentException_If_EpisodeId_Not_Greater_Than_Zero() { EpisodeClientMock episodeClientMock = EpisodeClientMock.Create(); await Assert.ThrowsAsync <ArgumentException>(() => episodeClientMock.GetEpisodeByIdResponseAsync(PodcastId, -1)); }