Пример #1
0
        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);
        }
Пример #2
0
        public void TestRentalManagerAddInvoice()
        {
            // 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();

            // Setup
            manager.AddInvoice(client, ReservationArrangementType.AIRPORT, new DateTime(2020, 8, 20, 10, 0, 0), new DateTime(2020, 8, 20, 13, 0, 0), new List <Car>()
            {
                car
            }, 6.0);

            // Check
            Invoice            invoice      = manager.GetAllInvoices().Last();
            List <InvoiceItem> invoiceItems = manager.GetInvoiceItems(invoice.ID);

            Assert.AreEqual(invoice.ClientID, client.ID);
            Assert.AreEqual(invoice.DiscountPercent, 0);
            Assert.AreEqual(invoice.Discount, 0);
            Assert.AreEqual(invoice.VATPercent, 6.0);
            Assert.AreEqual(invoice.VAT, 42.9);
            Assert.AreEqual(invoice.SubTotal, 715);
            Assert.AreEqual(invoice.TotalExc, 715);
            Assert.AreEqual(invoice.TotalInc, 757.9);
            Assert.AreEqual(invoice.PaymentDue, 757.9);
            Assert.AreEqual(invoiceItems.Count, 1);
        }
Пример #3
0
        public void TestCarGetPrice()
        {
            // Setup
            RentalManager manager = new RentalManager(new UnitOfWork(new RentalContext("development")));

            manager.AddCar("Porsche", "Cayenne Limousine", "White", 310, 1500, 1200, 1600, true);

            // Check
            Assert.AreNotEqual(manager.GetAllCars().Count, 0);
            Car car = manager.GetAllCars().Last();

            Assert.AreEqual(car.GetPrice(new DateTime(2020, 8, 20, 10, 0, 0), new DateTime(2020, 8, 20, 13, 0, 0), ReservationArrangementType.AIRPORT), 715);
        }
Пример #4
0
        private void InitializeDataGrid_Data()
        {
            carTable.Rows.Clear();
            RentalManager manager = new RentalManager(new UnitOfWork(new RentalContext()));

            foreach (Car car in manager.GetAllCars())
            {
                AddTableRow(car.ID, car.Brand, car.Type, car.Color, car.PriceFirst, car.PriceNight, car.PriceWedding, car.PriceWellness, car.Available);
            }
        }
Пример #5
0
        public void TestRentalManagerAddCar()
        {
            // Setup
            RentalManager manager = new RentalManager(new UnitOfWork(new RentalContext("development")));

            manager.AddCar("Porsche", "Cayenne Limousine", "White", 310, 1500, 1200, 1600, true);

            // Check
            Assert.AreNotEqual(manager.GetAllCars().Count, 0);
            Car car = manager.GetAllCars().Last();

            Assert.AreEqual(car.Brand, "Porsche");
            Assert.AreEqual(car.Type, "Cayenne Limousine");
            Assert.AreEqual(car.Color, "White");
            Assert.AreEqual(car.PriceFirst, 310);
            Assert.AreEqual(car.PriceNight, 1500);
            Assert.AreEqual(car.PriceWedding, 1200);
            Assert.AreEqual(car.PriceWellness, 1600);
            Assert.AreEqual(car.Available, true);
        }
Пример #6
0
        public void TestRentalManagerGetAllCars()
        {
            RentalManager manager = new RentalManager(new UnitOfWork(new RentalContext("development")));

            Assert.AreNotEqual(manager.GetAllCars().Count, 0);
        }