Пример #1
0
        public async Task return_single_country()
        {
            var mockHttp = new MockHttpMessageHandler();

            //setup mock test
            mockHttp.When("https://api.covid19api.com/countries")
            .Respond("application/json", "{ 'Country': 'Barbados'} ");     // respond with Barbados

            var client = mockHttp.ToHttpClient();

            var apiservice = new CovidService(client);
            var user       = await apiservice.GetCountry <SingleCountry>();

            user.Country.ShouldBe("Barbados");
        }