public void SalesOrderLinesController_Create_isNotValid() { SalesOrderLine testSalesOrderLine = new SalesOrderLine(); testSalesOrderLine.salesOrderItemQty = 99; SalesOrderLinesController controller = new SalesOrderLinesController(); controller.ModelState.AddModelError("", "error message"); var result = controller.Create(testSalesOrderLine) as ViewResult; SalesOrderLine resultSalesOrderLines = (SalesOrderLine)result.Model; Assert.AreEqual((short)99, resultSalesOrderLines.salesOrderItemQty); }
public void SalesOrderLinesController_Create_isValid() { SalesOrderLine testSalesOrderLine = new SalesOrderLine(); testSalesOrderLine.salesOrderID = 1; testSalesOrderLine.salesOrderItemPrice = 1; testSalesOrderLine.productID = 1; testSalesOrderLine.salesOrderItemQty = 1; testSalesOrderLine.salesOrderLinesSubtotal = 1; SalesOrderLinesController controller = new SalesOrderLinesController(); var result = (RedirectToRouteResult)controller.Create(testSalesOrderLine); Assert.AreEqual("Details", result.RouteValues["action"]); }