public static Object getDao(String daoName) { if (daoName.Equals("DELIVERY_NOTE")) { IDeliveryNoteDAO dao = new DeliveryNoteDAOImpl(); return dao; } else if (daoName.Equals("RECEIVE_NOTE")) { var dao = new ReceiveNoteDAOImpl(); return dao; } else if(daoName.Equals("CAR")) { ICarDAO dao = new CarDAOImpl(); return dao; } else if (daoName.Equals("LOCATION")) { ILocationDAO dao = new LocationDAOImpl(); return dao; } else { return null; } }
public void CreateDeliveryNote_WithValidData() { int expectedRow = 1; IDeliveryNoteDAO dao = new DeliveryNoteDAOImpl(); PrepareDeliveryNoteData.DeleteAllSampleData(); DeliveryNote note = PrepareDeliveryNoteData.SampleData(); IDeliveryNoteService deliveryNotenService = new DeliveryNoteServiceImpl(); deliveryNotenService.CreateDeliveryNote(note); int actualRow = dao.CountDeliveryNote("DN001"); PrepareDeliveryNoteData.DeleteAllSampleData(); Assert.AreEqual(expectedRow, actualRow, "Failed"); }
public void DeleteDeliveryNote_WithValidData() { int expectedRow = 0; PrepareDeliveryNoteData.DeleteAllSampleData(); DeliveryNote note = PrepareDeliveryNoteData.SampleData(); IDeliveryNoteService deliveryNotenService = new DeliveryNoteServiceImpl(); IDeliveryNoteDAO dao = new DeliveryNoteDAOImpl(); dao.CreateDeliveryNote(note); int id = context.DeliveryNotes.Where(b => b.Code == "DN001").FirstOrDefault().Id; deliveryNotenService.DeleteDeliveryNote(id); int actualRow = dao.CountDeliveryNote("DN001"); Assert.AreEqual(expectedRow, actualRow, "Failed"); }