Beispiel #1
0
        public void getExistingCustomerByName()
        {
            Customer           isActual           = new Customer("Helena", "lenka_bokshic");
            CustomerController customerController = new CustomerController();
            Customer           expected           = customerController.AddNewCustomerOrGetExisting(isActual.Name, isActual.Email);

            Assert.AreEqual(expected.Name, isActual.Name);
        }
Beispiel #2
0
        public void addNewCustomer()
        {
            Customer           isActual           = new Customer("Ivan", "Ivanov");
            CustomerController customerController = new CustomerController();
            Customer           expected           = customerController.AddNewCustomerOrGetExisting(isActual.Name, isActual.Email);

            Assert.AreEqual(expected.Name, isActual.Name);
        }
        public void notTicketBookedByCustomer()
        {
            CustomerController customerController = new CustomerController();
            Customer           customer           = customerController.AddNewCustomerOrGetExisting("Ivan", "ivan_ivanov");
            FlightController   flightController   = new FlightController();

            Assert.Throws <BookingException>(() => flightController.GetFlightsBookedByCustomer(customer));
        }
        public void notAvailableFlight()
        {
            CustomerController customerController = new CustomerController();
            Customer           customer           = customerController.AddNewCustomerOrGetExisting("Helena", "lenka_bokshic");
            FlightController   flightController   = new FlightController();

            Assert.Throws <BookingException>(() => flightController.GetAvailableFlight(customer));
        }
        public void getTicketsBookedExistingCustomerByLength()
        {
            CustomerController customerController   = new CustomerController();
            int                    isActual         = 2;
            Customer               customer         = customerController.AddNewCustomerOrGetExisting("Helena", "lenka_bokshic");
            FlightController       flightController = new FlightController();
            AirTicketOfficeContext availableFlight  = flightController.GetFlightsBookedByCustomer(customer);

            Assert.AreEqual(availableFlight.Flights.Length, isActual);
        }
        public void getAvailableFlightOfExistingCustomerByLength()
        {
            CustomerController customerController   = new CustomerController();
            int                    isActual         = 1;
            Customer               customer         = customerController.AddNewCustomerOrGetExisting("Matvey", "matvey_anisovich");
            FlightController       flightController = new FlightController();
            AirTicketOfficeContext availableFlight  = flightController.GetAvailableFlight(customer);

            Assert.AreEqual(availableFlight.Flights.Length, isActual);
        }
        public void getAvailableFlightOfNewCustomerByLength()
        {
            CustomerController     customerController = new CustomerController();
            Customer               customer           = customerController.AddNewCustomerOrGetExisting("Ivan", "ivan_ivanov");
            FlightController       flightController   = new FlightController();
            AirTicketOfficeContext context            = AirTicketOfficeContext.Context;
            AirTicketOfficeContext availableFlight    = flightController.GetAvailableFlight(customer);

            Assert.AreEqual(availableFlight.Flights.Length, context.SizeOfFlight());
        }
Beispiel #8
0
        public static void Main(string[] args)
        {
            try
            {
                Printer.print("Hi! What is your name?");
                String name = UserInput.input();
                Printer.print("What is your email?");
                String             email = UserInput.input();
                CustomerController customerController = new CustomerController();
                Customer           customer           = customerController.AddNewCustomerOrGetExisting(name, email);
                FlightController   flightController   = new FlightController();

                Printer.print("What do you want: 1)book or 2)return ticket?");
                int action = Convert.ToInt32(UserInput.input());
                CustomerAction.ChoicebyCustomer(flightController, customer, action);
            }
            catch (InputException ex)
            {
                Printer.print(($"Error: {ex.Message}"));
                logger.Error($"Error: {ex.Message}");
            }
        }
Beispiel #9
0
        public void addNewCustomerOrGetExisting()
        {
            CustomerController customerController = new CustomerController();

            Assert.Throws <InputException>(() => customerController.AddNewCustomerOrGetExisting("", ""));
        }