public void FindByIdTestNotNull() { // Arrange purchaseOrderRepository.Save(new PurchaseOrder() { PurchaseOrderNo = "DOREPOTEST", CreatedDateTime = DateTime.Now, }); // Act var result = purchaseOrderRepository.FindById("DOREPOTEST"); // Assert Assert.IsInstanceOfType(result, typeof(PurchaseOrder)); }
public void SaveTest() { // Arrange PurchaseOrder po = purchaseOrderRepository.FindById("VALLI"); DeliveryOrder d1 = new DeliveryOrder(); d1.DeliveryOrderNo = "DODTEST"; d1.PurchaseOrder = po; d1.CreatedDateTime = DateTime.Now; //Act var result = deliveryOrderService.Save(d1); //Assert Assert.AreEqual("DODTEST", result.DeliveryOrderNo); deliveryOrderRepository.Delete(d1); }
public PurchaseOrder FindPurchaseOrderById(string purchaseOrderNo) { if (purchaseOrderRepository.ExistsById(purchaseOrderNo)) { return(purchaseOrderRepository.FindById(purchaseOrderNo)); } else { return(null); } }
public Domain.BE.PurchaseOrder GetPurchaseOrderbyNumber(int id) { try { PurchaseOrderRepository repo = new PurchaseOrderRepository(context); return(repo.FindById(id)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public void TestCleanup() { if (purchaseOrderDetailRepository.ExistsById("PODREPOTEST", "E030")) { purchaseOrderDetailRepository.Delete(purchaseOrderDetailRepository.FindById("PODREPOTEST", "E030")); } if (purchaseOrderDetailRepository.ExistsById("PODREPOTEST", "P030")) { purchaseOrderDetailRepository.Delete(purchaseOrderDetailRepository.FindById("PODREPOTEST", "P030")); } if (purchaseOrderRepository.ExistsById("PODREPOTEST")) { purchaseOrderRepository.Delete(purchaseOrderRepository.FindById("PODREPOTEST")); } }
public void Cleanup() { //1 bool check = purchaseOrderRepository.ExistsById("PUR-1"); if (check) { purchaseOrderRepository.Delete(purchaseOrderRepository.FindById("PUR-1")); } check = purchaseOrderRepository.ExistsById("PUR-3"); if (check) { purchaseOrderRepository.Delete(purchaseOrderRepository.FindById("PUR-3")); } check = supplierRepository.ExistsById("SUP1"); if (check) { supplierRepository.Delete(supplierRepository.FindById("SUP1")); } check = itemRepository.ExistsById("IT8"); if (check) { itemRepository.Delete(itemRepository.FindById("IT8")); } check = itemRepository.ExistsById("IT9"); if (check) { itemRepository.Delete(itemRepository.FindById("IT9")); } check = purchaseOrderRepository.ExistsById("PUR-4"); if (check) { purchaseOrderRepository.Delete(purchaseOrderRepository.FindById("PUR-4")); } //3 bool exist = purchaseOrderRepository.ExistsById("TEST10"); if (exist) { purchaseOrderRepository.Delete(purchaseOrderRepository.FindById("TEST10")); } //5 exist = purchaseOrderRepository.ExistsById("DUMMY"); if (exist) { purchaseOrderRepository.Delete(purchaseOrderRepository.FindById("DUMMY")); } //6 exist = purchaseOrderRepository.ExistsById("DUMMYS1"); if (exist) { purchaseOrderRepository.Delete(purchaseOrderRepository.FindById("DUMMYS1")); } exist = purchaseOrderRepository.ExistsById("DUMMYS2"); if (exist) { purchaseOrderRepository.Delete(purchaseOrderRepository.FindById("DUMMYS2")); } exist = purchaseOrderRepository.ExistsById("DUMMYS3"); if (exist) { purchaseOrderRepository.Delete(purchaseOrderRepository.FindById("DUMMYS3")); } //7 exist = purchaseOrderRepository.ExistsById("DUMMYSA1"); if (exist) { purchaseOrderRepository.Delete(purchaseOrderRepository.FindById("DUMMYSA1")); } exist = purchaseOrderRepository.ExistsById("DUMMYSA2"); if (exist) { purchaseOrderRepository.Delete(purchaseOrderRepository.FindById("DUMMYSA2")); } exist = purchaseOrderRepository.ExistsById("STATUSTEST"); if (exist) { purchaseOrderRepository.Delete(purchaseOrderRepository.FindById("STATUSTEST")); } //11 exist = purchaseOrderRepository.ExistsById("PO1"); if (exist) { purchaseOrderRepository.Delete(purchaseOrderRepository.FindById("PO1")); } exist = purchaseOrderDetailRepository.ExistsById("PO1", "ITEM"); if (exist) { purchaseOrderDetailRepository.Delete(purchaseOrderDetailRepository.FindById("PO1", "ITEM")); } exist = itemRepository.ExistsById("ITEM"); if (exist) { itemRepository.Delete(itemRepository.FindById("ITEM")); } exist = itemPriceRepository.ExistsById("ITEM", "CHEP"); if (exist) { itemPriceRepository.Delete(itemPriceRepository.FindById("ITEM", "CHEP")); } //12 exist = purchaseOrderRepository.ExistsById("PO2"); if (exist) { purchaseOrderRepository.Delete(purchaseOrderRepository.FindById("PO2")); } exist = itemRepository.ExistsById("ITM2"); if (exist) { itemRepository.Delete(itemRepository.FindById("ITM2")); } exist = itemPriceRepository.ExistsById("ITM2", "CHEP"); if (exist) { itemPriceRepository.Delete(itemPriceRepository.FindById("ITM2", "CHEP")); } //13 exist = deliveryOrderRepository.ExistsById("DO1"); if (exist) { deliveryOrderRepository.Delete(deliveryOrderRepository.FindById("DO1")); } exist = deliveryOrderRepository.ExistsById("DO2"); if (exist) { deliveryOrderRepository.Delete(deliveryOrderRepository.FindById("DO2")); } exist = purchaseOrderRepository.ExistsById("PO3"); if (exist) { purchaseOrderRepository.Delete(purchaseOrderRepository.FindById("PO3")); } exist = itemRepository.ExistsById("IT3"); if (exist) { itemRepository.Delete(itemRepository.FindById("IT3")); } exist = itemRepository.ExistsById("IT4"); if (exist) { itemRepository.Delete(itemRepository.FindById("IT4")); } //14 exist = deliveryOrderRepository.ExistsById("DO3"); if (exist) { deliveryOrderRepository.Delete(deliveryOrderRepository.FindById("DO3")); } exist = deliveryOrderRepository.ExistsById("DO4"); if (exist) { deliveryOrderRepository.Delete(deliveryOrderRepository.FindById("DO4")); } exist = purchaseOrderRepository.ExistsById("PO4"); if (exist) { purchaseOrderRepository.Delete(purchaseOrderRepository.FindById("PO4")); } exist = itemRepository.ExistsById("IT5"); if (exist) { itemRepository.Delete(itemRepository.FindById("IT5")); } exist = itemRepository.ExistsById("IT6"); if (exist) { itemRepository.Delete(itemRepository.FindById("IT6")); } List <PurchaseOrder> poLIST = context.PurchaseOrder.Where(x => x.ApprovedDateTime == new DateTime(1993, 7, 9)).ToList(); foreach (PurchaseOrder p in poLIST) { purchaseOrderRepository.Delete(p); } }