public IHttpActionResult PostSUPPLIER([PexAssumeUnderTest] SUPPLIERsController target, SUPPLIER sUPPLIER) { IHttpActionResult result = target.PostSUPPLIER(sUPPLIER); return(result); // TODO: add assertions to method SUPPLIERsControllerTest.PostSUPPLIER(SUPPLIERsController, SUPPLIER) }
public void AddSupplierTest() { SupplierModel model = new SupplierModel { SUPLNO = "1", SUPLNAME = "Supplier1", SUPLADDR = "SuppAddress1" }; mockSupplierRepository.Setup(s => s.AddSupplier(It.IsAny <SupplierModel>())).Returns(Task.FromResult(model.SUPLNO).Result); var result = controller.PostSUPPLIER(model) as CreatedAtRouteNegotiatedContentResult <SupplierModel>; Assert.AreEqual(model.SUPLNO, result.Content.SUPLNO); }
public void Test_AddSupplier() { var controller = new SUPPLIERsController(); SUPPLIER Sup = new SUPPLIER { SUPLNO = "10", SUPLADDR = "Chennai", SUPLNAME = "NRN" }; IHttpActionResult actionResult = controller.PostSUPPLIER(Sup); var result = actionResult as CreatedAtRouteNegotiatedContentResult <SUPPLIER>; Assert.IsNotNull(result); Assert.AreEqual("DefaultApi", result.RouteName); Assert.IsNotNull(result.RouteValues["id"]); }