Administrasjon.Controllers.AdminOrderController.findOrders C# (CSharp) Method

findOrders() public method

public findOrders ( int id ) : System.Web.Mvc.ActionResult
id int
return System.Web.Mvc.ActionResult
        public ActionResult findOrders(int id)
        {
            var orders = _orderBLL.findOrders(id);
            if (orders != null)
                return View("HelpView", orders);

            return RedirectToAction("AllCustomers","AdminCustomer");
        }

Usage Example

 public void findOrdersTestTrue()
 {
     //Arrange
     var controller = new AdminOrderController(new OrderBLL(new OrderDALStub()), new LoggingBLL(new LoggingDALStub()));
     var list = new List<OrderModel>();
     var orderModel = new OrderModel();
     orderModel.customerID = 1;
     orderModel.orderNr = 1;
     orderModel.total = 100;
     list.Add(orderModel);
     list.Add(orderModel);
     list.Add(orderModel);
     list.Add(orderModel);
     //Act
     var result = (ViewResult)controller.findOrders(1);
     var resultList = (List<OrderModel>)result.Model;
     //Assert
     Assert.AreEqual(result.ViewName, "HelpView");
     Assert.AreEqual(resultList.Count, list.Count);
     for (int i = 0; i < resultList.Count; i++)
     {
         Assert.AreEqual(resultList[i].customerID, list[i].customerID);
         Assert.AreEqual(resultList[i].orderNr, list[i].orderNr);
         Assert.AreEqual(resultList[i].total, list[i].total);
     }
 }
All Usage Examples Of Administrasjon.Controllers.AdminOrderController::findOrders