public void SetEndpointsContainer()
 {
     WeatherEndpoint     = new WeatherEndpoint();
     FindEndpoint        = new FindEndpoint();
     GroupEndpoint       = new GroupEndpoint();
     NonExistingEndpoint = new NonExistingEndpoint();
 }
Exemplo n.º 2
0
        public CommonResponse SendRequestCheckResponse(Request request, CommonResponse expectedResponse, RequestType requestType = RequestType.Get)
        {
            Response       response       = WeatherEndpoint.SendGetRequest(request).Execute().GetResponse(0);
            CommonResponse actualResponse = JsonConvert.DeserializeObject <CommonResponse>(response.ResponseBody);

            Comparator.CompareObjects(actualResponse, expectedResponse);
            return(actualResponse);
        }
        public void GetWeatherViaInvalidUrl()
        {
            ByCityCountryRequest request          = new ByCityCountryRequest("London");
            CommonResponse       expectedResponse = new CommonResponse(null, 401).SetMessage("Invalid API key. Please see http://openweathermap.org/faq#error401 for more info.");
            Response             response         = WeatherEndpoint.SendGetRequest(request, "https://api.openweathermap.org/data/2.5weatherAPPID=9acb0f4df01ac2645b18fabf8ac4bdc6").Execute().GetResponse(0);
            CommonResponse       actualResponse   = JsonConvert.DeserializeObject <CommonResponse>(response.ResponseBody);

            Comparator.CompareObjects(actualResponse, expectedResponse);
        }
Exemplo n.º 4
0
        public static void MapWeather(this IEndpointRouteBuilder endpoint, string path)
        {
            var formatter = endpoint.ServiceProvider.GetRequiredService <IResponseFormatter>();

            endpoint.MapGet(path, context => WeatherEndpoint.Endpoint(context, formatter));
        }