public void PurchaseOrderLinesController_Create_isNotValid() { PurchaseOrderLine testPurchaseOrderLine = new PurchaseOrderLine(); testPurchaseOrderLine.purchaseOrderItemQty = 99; PurchaseOrderLinesController controller = new PurchaseOrderLinesController(); controller.ModelState.AddModelError("", "error message"); var result = controller.Create(testPurchaseOrderLine) as ViewResult; PurchaseOrderLine resultPurchaseOrderLines = (PurchaseOrderLine)result.Model; Assert.AreEqual((short)99, resultPurchaseOrderLines.purchaseOrderItemQty); }
public void PurchaseOrderLinesController_Create_isValid() { PurchaseOrderLine testPurchaseOrderLine = new PurchaseOrderLine(); testPurchaseOrderLine.purchaseOrderID = 1; testPurchaseOrderLine.purchaseOrderItemPrice = 1; testPurchaseOrderLine.rawMaterialsID = 1; testPurchaseOrderLine.purchaseOrderItemQty = 1; testPurchaseOrderLine.purchaseOrderLineSubtotal = 1; PurchaseOrderLinesController controller = new PurchaseOrderLinesController(); var result = (RedirectToRouteResult)controller.Create(testPurchaseOrderLine); Assert.AreEqual("Details", result.RouteValues["action"]); }