public async void PostPrecisePrice_WithInValidInput_ExpectReturn10000() { PostPrecisePriceRequest request = new PostPrecisePriceRequest() { Agent = 103, Boli = 1, Bujimianchesun = 1, Bujimiandaoqiang = 1 }; var controller = new CarInsuranceController(_carInsuranceService.Object) { Request = new HttpRequestMessage { Properties = { { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() } } } }; _carInsuranceService.Setup(x => x.InsertUserInfo(request, controller.Request.GetQueryNameValuePairs())) .Returns(PostBaoJia); controller.ModelState.AddModelError("车牌号", "不能为空"); HttpResponseMessage message = await controller.PostPrecisePrice(request); NUnit.Framework.Assert.AreEqual(-10000, message.Content.ReadAsAsync <GetReInfoViewModel>().Result.BusinessStatus); }
public async void FetchReInsuranceInfo_Get_NoSaveQuote_Returns_10002() { GetReInfoRequest request = new GetReInfoRequest { AgentId = 103, CityCode = 1, SecCode = "XSFSDSFD" }; CarInsuranceController controller = new CarInsuranceController(_carInsuranceService.Object) { Request = new HttpRequestMessage { Properties = { { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() } } } }; _carInsuranceService.Setup(x => x.GetReInfo(request, controller.Request.GetQueryNameValuePairs())).Returns(GetReInfo_SaveQuote_NOFound); HttpResponseMessage message = await controller.FetchReInsuranceInfo(request); NUnit.Framework.Assert.AreEqual(-10002, message.Content.ReadAsAsync <GetReInfoViewModel>().Result.BusinessStatus); }