public Info InfoModel(WebResponseModel webResponse, Info infoModel) { if (webResponse.Payloay == null) { throw new Exception("webResponse payload is null. Unable to bind null."); } infoModel = JsonConvert.DeserializeObject<Info>(webResponse.Payloay, JsonSerializerSettings); infoModel.Header = PopulateHeader(infoModel.Header, webResponse); infoModel.Wrapper = PopulateWrapper(infoModel.Wrapper, webResponse); return infoModel; }
public Info Info() { var infoModel = new Info() { }; var requestModel = _requestModelFactory.NewInfoRequestModel(ApiUrl, "info"); try { // Making Api request and binding result to model var webResponse = _apiProvider.MakeGetRequest(requestModel); infoModel = _responsePopulation.InfoModel(webResponse, infoModel); if (infoModel.engineVersion != null) { infoModel.Online = true; } } catch (Exception ex) { infoModel.HasErrorOccurred = true; infoModel.Errors.Add(new Error { message = ex.ToString() }); } if (infoModel.Errors.Count != 0 && !infoModel.HasErrorOccurred) { infoModel.HasErrorOccurred = true; } return infoModel; }
public static void Setup(TestContext testContext) { var ssllService = new SSLLabsApiService(ConfigurationManager.AppSettings.Get("ApiUrl")); _info = ssllService.Info(); }