コード例 #1
0
        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);
        }
コード例 #2
0
        public async Task GetEpisodesResponseAsync_Should_Throw_ArgumentException_If_PodcastId_Not_Greater_Than_Zero()
        {
            EpisodeClientMock episodeClientMock = EpisodeClientMock.Create();

            await Assert.ThrowsAsync <ArgumentException>(() => episodeClientMock.GetEpisodesResponseAsync(-1));
        }