public void TestRentalManagerRemoveInvoice() { // Pre-setup RentalManager manager = new RentalManager(new UnitOfWork(new RentalContext("development"))); manager.AddClient("Tim", "De Smet", "*****@*****.**", "0493100289", "Azaleastraat", "57", "", "9940", "Evergem", "Belgium", ClientType.AGENCY, "Jetstax", "BE0730.671.009"); Assert.AreNotEqual(manager.GetAllClients().Count, 0); Client client = manager.GetAllClients().Last(); manager.AddCar("Porsche", "Cayenne Limousine", "White", 310, 1500, 1200, 1600, true); Assert.AreNotEqual(manager.GetAllCars().Count, 0); Car car = manager.GetAllCars().Last(); manager.AddReservation(client, ReservationArrangementType.AIRPORT, new DateTime(2020, 8, 20, 10, 0, 0), new DateTime(2020, 8, 20, 13, 0, 0), "Gent", "Gent", new List <Car>() { car }, DateTime.Now, 6.0); // Setup Assert.AreNotEqual(manager.GetAllReservations().Count, 0); Reservation reservation = manager.GetAllReservations().Last(); int count = manager.GetAllReservations().Count; manager.RemoveReservation(reservation); // Check Assert.AreEqual(manager.GetAllReservations().Count, count - 1); }
public void TestRentalManagerGetAllReservation() { // Setup RentalManager manager = new RentalManager(new UnitOfWork(new RentalContext("development"))); // Check Assert.AreNotEqual(manager.GetAllReservations().Count, 0); }
private void InitializeDataGrid_Data() { reservationTable.Rows.Clear(); RentalManager manager = new RentalManager(new UnitOfWork(new RentalContext())); foreach (Reservation reservation in manager.GetAllReservations()) { DomainLayer.Domain.Invoice invoice = manager.GetInvoice(reservation.InvoiceID); Client client = manager.GetClient(reservation.ClientID); List <Car> reservationCars = manager.GetReservationCars(reservation.ID); StringBuilder sb = new StringBuilder(); foreach (Car car in reservationCars) { sb.Append("#" + car.ID + " " + car.Brand + " " + car.Type + ","); } String cars = reservationCars.ToString(); AddTableRow(reservation.ID, client.FirstName + " " + client.LastName, sb.ToString().Substring(0, sb.ToString().Length - 1), reservation.ReservationDate, reservation.ReservedUntil, (reservation.ReservationEnded > DateTime.MinValue) ? reservation.ReservationEnded.ToString() : "", char.ToUpper(reservation.Arrangement.ToString().ToLower()[0]) + reservation.Arrangement.ToString().ToLower().Substring(1), reservation.StartLocation, reservation.EndLocation, reservation.OrderDate, invoice.ID, "€" + invoice.TotalInc, (invoice.PaymentDue == 0) ? "Paid" : "Unpaid"); } }