public void CedantsController_GetCedant_OKResponse(CedantsSearchCriteria criteria) { #region Arrange SetupUserIdentity(); SetupCedantRepository(out Mock <ICedantRepository> cedantRepository, criteria); var httpRequest = new HttpRequestMessage(new HttpMethod(AppSettings.HTTPPOST), $"{AppSettings.BASEURL}{RouteHelper.CedantsRoutePrefix}"); CedantsController cedantsController = CreateCedantController(httpRequest, cedantRepository.Object); #endregion #region Act #endregion #region Expected Data var expectedCedants = new Cedant() // grs_VGrsCedant() { Cedantid = 56495, Name = "Starr Indemnity & Liability Company", //Parentgrouptypeid = 10011, //Parentgrouptype = "Reinsurance Cedant Group", Cedantgroupid = 1019169, Cedantgroupname = "Starr International Company, Inc.", Locationid = 244894, //Locationname = "Starr Indemnity", Locationaddress = "8401 N Central Expressway", Locationcity = "Dallas", Locationstate = "TX", Locationpostcode = null, Country = "United States" //Parentcompanyname = null, //Cedantcategories = "Global Re Cedant", //Cedantcategoryid = "90" }; #endregion #region Assert if (cedantsController.Get(criteria) is NegotiatedContentResult <ResponseCollection <Cedant> > contentResult) { Assertions.AssertOkResponse(contentResult); for (int i = 0; i <= contentResult.Content.results.Count - 1; i++) { var actualCedants = contentResult.Content.results[i].data; Assertions.AssertData(expectedCedants, actualCedants); Assert.IsEmpty(contentResult.Content.results[i].messages); } } #endregion }
public void CedantsController_GetCedent_NotFoundAPIException(CedantsSearchCriteria criteria) { #region Arrange SetupUserIdentity(); SetupCedantRepository(out Mock <ICedantRepository> cedantRepository, criteria); var httpRequest = new HttpRequestMessage(new HttpMethod(AppSettings.HTTPPOST), $"{AppSettings.BASEURL}{RouteHelper.CedantsRoutePrefix}"); CedantsController cedantsController = CreateCedantController(httpRequest, cedantRepository.Object); #endregion #region Act #endregion #region Assert IHttpActionResult actionResult = cedantsController.Get(criteria.CedantName); Assert.AreEqual(HttpStatusCode.BadRequest, ((StatusCodeResult)actionResult).StatusCode); #endregion }