示例#1
0
        public async Task NotSuccessStatusCode_ThrowsHttpRequestException()
        {
            var mockHttpHandler = HttpHandler.GetMockFailedHttpHandlerObject();
            var giphy           = new Giphy(mockHttpHandler);
            var id = "xT4uQulxzV39haRFjG";

            _ = await Assert.ThrowsAsync <HttpRequestException>(() => giphy.GifById(id));
        }
示例#2
0
        public async Task GifIdIsEmpty_ThrowsFormatException()
        {
            var giphy = new Giphy("test");

            string id = "";

            _ = await Assert.ThrowsAsync <FormatException>(() => giphy.GifById(id));
        }
示例#3
0
        public async Task WhenCalled_ReturnsGiphySingle()
        {
            var mockHttpHandler = HttpHandler.GetMockSuccessHttpHandlerObject();
            var giphy           = new Giphy(mockHttpHandler);
            var id = "xT4uQulxzV39haRFjG";

            var actual = await giphy.GifById(id);

            Assert.NotNull(actual);
            Assert.IsType <GiphySingle>(actual);
        }