public async Task ThrowIfConnectionParamEmpty(string connection)
        {
            var httpWrapper = new Mock <IHttpWrapper>();

            var apiRequester = new APIRequester(httpWrapper.Object);

            await Assert.ThrowsExceptionAsync <ArgumentNullException>(() => apiRequester.Request(connection));
        }
        public async Task ThrowIfReponseIsEmpty(string response)
        {
            var httpWrapper = new Mock <IHttpWrapper>();

            httpWrapper.Setup(hw => hw.GetStringAsync("connection"))
            .ReturnsAsync(response);

            var apiRequester = new APIRequester(httpWrapper.Object);

            await Assert.ThrowsExceptionAsync <ArgumentNullException>(() => apiRequester.Request("connection"));
        }
        public async Task ReturnReponseIfEverythingIsValid()
        {
            var httpWrapper = new Mock <IHttpWrapper>();

            httpWrapper.Setup(hw => hw.GetStringAsync("connection"))
            .ReturnsAsync("response");

            var apiRequester = new APIRequester(httpWrapper.Object);

            var result = await apiRequester.Request("connection");

            Assert.AreEqual("response", result);
        }
Example #4
0
        public Response Query()
        {
            String url = String.Format("http://api.zeit.de/client?api_key={0}", this.API.APIKey);

            return(APIRequester.Request <Response>(url, this.API));
        }