public void AddWorkOrder_ExpectedBehavior_ReturnsTestWorkOrder() { // Arrange WorkOrder item = MakeTestWorkOrder(); var workOrdersRepo = new WorkOrdersRepo(); // Act var result = workOrdersRepo.Add(item); // Assert Assert.AreEqual(item, result); }
public void DeleteWorkOrder_ExpectedBehaviour_WorkOrderRemoved() { // Arrange WorkOrder item = MakeTestWorkOrder(); var workOrdersRepo = new WorkOrdersRepo(); // Act var result = workOrdersRepo.Remove(item.WoNumber); WorkOrder retrieved = workOrdersRepo.GetById(item.WoNumber); // Assert Assert.AreEqual(result, 1); Assert.AreEqual(retrieved, null); }
public void GetWorkOrder_ExpectedBehavior_ReturnsTestWorkOrder() { // Arrange WorkOrder item = MakeTestWorkOrder(); var workOrdersRepo = new WorkOrdersRepo(); // Act WorkOrder retrieved = workOrdersRepo.GetById(item.WoNumber); // Assert Assert.AreEqual(retrieved.AssemblyNumber, item.AssemblyNumber); Assert.AreEqual(retrieved.Customer, item.Customer); Assert.AreEqual(retrieved.CustomerPO, item.CustomerPO); Assert.AreEqual(retrieved.DueDate, item.DueDate); Assert.AreEqual(retrieved.QuantityToBuild, item.QuantityToBuild); Assert.AreEqual(retrieved.SalesOrder, item.SalesOrder); Assert.AreEqual(retrieved.SalesOrderLineItemNo, item.SalesOrderLineItemNo); Assert.AreEqual(retrieved.WoNumber, item.WoNumber); Assert.AreEqual(retrieved.WoStatus, item.WoStatus); }
public JsonResult SearchServerSide() { // Get Server Side Parameters from Request int start = Convert.ToInt32(Request["start"]); int length = Convert.ToInt32(Request["length"]); string searchValue = Request["search[value]"]; string sortColumnName = Request["columns[" + Request["order[0][column]"] + "][name]"]; string sortDirection = Request["order[0][dir]"]; // Total record count int totalrows = workOrdersRepo.GetAll().Count(); // Search var searchResults = WorkOrdersRepo.Find(searchValue); int totalrowsafterfiltering = searchResults.Count(); // Sort searchResults = searchResults.OrderBy(sortColumnName + " " + sortDirection); // Page searchResults = searchResults.Skip(start).Take(length).ToList(); return(Json(new { data = searchResults, draw = Request["draw"], recordsTotal = totalrows, recordsFiltered = totalrowsafterfiltering }, JsonRequestBehavior.AllowGet)); }
public JsonResult Search(string searchstring) { var searchResults = WorkOrdersRepo.Find(searchstring).ToList(); return(Json(searchResults)); }
public WorkOrdersController() { this.workOrdersRepo = new WorkOrdersRepo(); }