public void CancelTicket()
        {
            countryDAO.Add(new Country("Israel"));

            airlineDAO.Add(new AirlineCompany("ELAL", "ELALUSERNAME", "ELALPASSEORD", countryDAO.GetCountryByName("Israel").ID));

            flightDAO.Add(new Flight(airlineDAO.GetAirlineByName("ELAL").ID, countryDAO.GetCountryByName("Israel").ID, countryDAO.GetCountryByName("Israel").ID, new DateTime(DateTime.Now.Year + 1, 12, 2), new DateTime(DateTime.Now.Year + 1, 12, 3), 30, FlightStatus.NotDeparted));
            Flight flightOne = flightDAO.GetAll()[0];

            customerDAO.Add(new Customer("FIRSTNAME", "LASTNAME", "USERNAME", "PASSWORD", "ADDRESS", "PNUMBER", "CNUMBER"));
            customerDAO.Add(new Customer("FIRSTNAME2", "LASTNAME2", "USERNAME2", "PASSWORD2", "ADDRESS2", "PNUMBER2", "CNUMBER2"));
            Customer customerOne = customerDAO.GetAll()[0];
            Customer customerTwo = customerDAO.GetAll()[1];

            LoginToken <Customer> customerLoggedIn = new LoginToken <Customer>();

            customerLoggedIn.user = customerOne;

            ticketDAO.Add(new Ticket(flightOne.ID, customerOne.ID));
            ticketDAO.Add(new Ticket(flightOne.ID, customerTwo.ID));
            Ticket ticketOne = ticketDAO.GetAll()[0];

            flightOne = flightDAO.GetAll()[0];

            Assert.AreEqual(28, flightOne.RemainingTickets);
            facade.CancelTicket(customerLoggedIn, ticketOne);
            flightOne = flightDAO.GetAll()[0];
            Assert.AreEqual(29, flightOne.RemainingTickets);
            Assert.AreEqual(1, ticketDAO.GetAll().Count);
        }
Ejemplo n.º 2
0
        public void CreateNewAirline()
        {
            countryDAO.Add(new Country("Israel"));

            facade.CreateNewAirline(new AirlineCompany("ElAl", "ElAl2004", "123456", countryDAO.GetCountryByName("Israel").ID));
            Assert.AreEqual("ElAl", airlineDAO.GetAirlineByName("ElAl").AirLineName);
            Assert.AreEqual("ElAl2004", airlineDAO.GetAirlineByName("ElAl").UserName);
            Assert.AreEqual("123456", airlineDAO.GetAirlineByName("ElAl").Password);
            Assert.AreEqual(countryDAO.GetCountryByName("Israel").ID, airlineDAO.GetAirlineByName("ElAl").CountryCode);
        }
Ejemplo n.º 3
0
        public void GetAllAirlineCompanies()
        {
            countryDAO.Add(new Country("Israel"));
            airlineDAO.Add(new AirlineCompany("ELAL", "ELALUSERNAME", "ELALPASSEORD", countryDAO.GetCountryByName("Israel").ID));
            airlineDAO.Add(new AirlineCompany("ARKIA", "ARKIAUSERNAME", "ARKIAPASSEORD", countryDAO.GetCountryByName("Israel").ID));

            Assert.AreEqual(2, facade.GetAllAirlineCompanies().Count);
        }
Ejemplo n.º 4
0
        public void CancelFlight()
        {
            countryDAO.Add(new Country("Israel"));

            airlineDAO.Add(new AirlineCompany("ELAL", "ELALUSERNAME", "ELALPASSEORD", countryDAO.GetCountryByName("Israel").ID));
            airlineDAO.Add(new AirlineCompany("ARKIA", "ARKIAYSERNAME", "ARKIAPASSWORD", countryDAO.GetCountryByName("Israel").ID));

            flightDAO.Add(new Flight(airlineDAO.GetAirlineByName("ELAL").ID, countryDAO.GetCountryByName("Israel").ID, countryDAO.GetCountryByName("Israel").ID, new DateTime(DateTime.Now.Year + 1, 12, 2), new DateTime(DateTime.Now.Year + 1, 12, 3), 30, FlightStatus.NotDeparted));
            flightDAO.Add(new Flight(airlineDAO.GetAirlineByName("ARKIA").ID, countryDAO.GetCountryByName("Israel").ID, countryDAO.GetCountryByName("Israel").ID, new DateTime(DateTime.Now.Year + 1, 12, 2), new DateTime(DateTime.Now.Year + 1, 12, 3), 30, FlightStatus.NotDeparted));

            customerDAO.Add(new Customer("FIRSTNAME", "LASTNAME", "USERNAME", "PASSWORD", "ADDRESS", "PNUMBER", "CNUMBER"));

            ticketDAO.Add(new Ticket(flightDAO.GetAll()[0].ID, customerDAO.GetCustomerByUsername("USERNAME").ID));
            ticketDAO.Add(new Ticket(flightDAO.GetAll()[1].ID, customerDAO.GetCustomerByUsername("USERNAME").ID));

            Assert.AreEqual(2, flightDAO.GetAll().Count);
            Assert.AreEqual(2, ticketDAO.GetAll().Count);

            LoginToken <AirlineCompany> airlineLoggenIn = new LoginToken <AirlineCompany>();

            airlineLoggenIn.user = airlineDAO.GetAirlineByName("ELAL");
            facade.CancelFlight(airlineLoggenIn, flightDAO.GetAll()[0]);
            Assert.AreEqual(1, flightDAO.GetAll().Count);
            Assert.AreEqual(1, ticketDAO.GetAll().Count);
        }
        public void LoginAirline()
        {
            countryDAO.Add(new Country("Israel"));
            AirlineCompany airlineUser = airlineDAO.Add(new AirlineCompany("ELAL", "ELALUSERNAME", "ELALPASSWORD", countryDAO.GetCountryByName("Israel").ID));

            FacadeBase  facade;
            ILoginToken loginToken;

            centerSystem.Login("ELALUSERNAME", "ELALPASSWORD", out facade, out loginToken);

            Assert.IsTrue(loginToken is LoginToken <AirlineCompany>);
            Assert.IsTrue(facade is LoggedInAirlineFacadeMSSQL);
        }