Пример #1
0
        public async Task GetEpisodeByIdResponseAsync_Should_Return_ApiResponse_With_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()
            });

            ApiResponse <Episode> apiResponse = await episodeClientMock.GetEpisodeByIdResponseAsync(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(apiResponse);
            Assert.NotNull(apiResponse.Model);
        }
Пример #2
0
        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));
        }