public Endpoint EndpointModel(WebResponseModel webResponse, Endpoint endpointModel) { endpointModel = JsonConvert.DeserializeObject<Endpoint>(webResponse.Payloay, JsonSerializerSettings); endpointModel.Header = PopulateHeader(endpointModel.Header, webResponse); endpointModel.Wrapper = PopulateWrapper(endpointModel.Wrapper, webResponse); return endpointModel; }
public static void Setup(TestContext testContext) { _endpointHost = ConfigurationManager.AppSettings.Get("EndpointHost"); _endpointIp = ConfigurationManager.AppSettings.Get("EndpointIP"); var ssllService = new SSLLabsApiService(ConfigurationManager.AppSettings.Get("ApiUrl")); _endpoint = ssllService.GetEndpointData(_endpointHost, _endpointIp); }
public Endpoint GetEndpointData(string host, string s, FromCache fromCache) { var endpointModel = new Endpoint(); // Checking host is valid before continuing if (!_urlValidation.IsValid(host)) { endpointModel.HasErrorOccurred = true; endpointModel.Errors.Add(new Error { message = "Host does not pass preflight validation. No Api call has been made." }); return endpointModel; } // Building request model var requestModel = _requestModelFactory.NewEndpointDataRequestModel(ApiUrl, "getEndpointData", host, s, fromCache.ToString()); try { var webResponse = _apiProvider.MakeGetRequest(requestModel); endpointModel = _responsePopulation.EndpointModel(webResponse, endpointModel); } catch (Exception ex) { endpointModel.HasErrorOccurred = true; endpointModel.Errors.Add(new Error { message = ex.ToString() }); } // Checking if errors have occoured either from ethier api or wrapper if (endpointModel.Errors.Count != 0 && !endpointModel.HasErrorOccurred) { endpointModel.HasErrorOccurred = true; } return endpointModel; }