public void CancelTicketTest()
        {
            TestData.DeleteAllData();
            getTokenAndGetFacade(out LoginToken <Admin> tokenAdmin, out LoggedInAdministratorFacade facadeAdmin,
                                 out LoginToken <Customer> tokenCustomer, out LoggedInCustomerFacade fasadeCustomer);
            flightDAOPGSQL.Add(CreateFlightForTest());
            var f = flightDAOPGSQL.GetAll()[0];

            fasadeCustomer.PurchaseTicket(tokenCustomer, f);
            var t = ticketDAOPGSQL.GetAll()[0];

            fasadeCustomer.CancelTicket(tokenCustomer, t, f);

            Assert.AreEqual(flightDAOPGSQL.GetAll()[0].Tickets_Remaining, TestData.CreateFlight_TicketsRemaining);
            Assert.AreEqual(null, ticketDAOPGSQL.Get((int)t.Id));
        }
Esempio n. 2
0
        public void CancelFlightTest()
        {
            TestData.DeleteAllData();
            getTokenAndGetFacade(out LoginToken <Admin> tokenAdmin, out LoggedInAdministratorFacade facadeAdmin,
                                 out LoginToken <AirlineCompany> tokenAirline, out LoggedsInAirlineFacade fasadeAirline);

            AirlineCompany airline = airlineCompanyDAOPGSQL.GetAirlineByUserame(TestData.CreateAirlineUser_Username);

            TestData.CreateAirlineCompany_Id = airline.Id;

            fasadeAirline.CreateFlight(tokenAirline, CreateFlightForTest());
            var f = facadeAdmin.GetAllFlights()[0];

            fasadeAirline.CancelFlight(tokenAirline, f);

            Assert.AreNotEqual(1, flightDAOPGSQL.GetAll().Count);
            Assert.AreEqual(0, flightDAOPGSQL.GetAll().Count);
        }
Esempio n. 3
0
        public void GetFlightByIdTest()
        {
            AnonymousUserFacade facade = FlightsCenterSystem.GetInstance().GetFacade <Anonymous>(null) as AnonymousUserFacade;

            TestData.DeleteAllData();

            flightDAOPGSQL.Add(CreateFlightForTest());

            var flights_list = flightDAOPGSQL.GetAll();

            Flight f = facade.GetFlightById((int)flights_list[0].Id);

            Assert.AreNotEqual(f, null);
            Assert.AreEqual(TestData.CreateAirlineCompany_Id, f.Airline_Company_Id);
            Assert.AreEqual(TestData.CreateFlight_OriginCountryId, f.Origin_Country_Id);
            Assert.AreEqual(TestData.CreateFlight_DestinationCountryId, f.Destination_Country_Id);
            Assert.AreEqual(TestData.CreateFlight_DepartureTime.AddHours(10), f.Departure_Time);
            Assert.AreEqual(TestData.CreateFlight_LandingTime.AddHours(10), f.Landing_Time);
            Assert.AreEqual(TestData.CreateFlight_TicketsRemaining, f.Tickets_Remaining);
        }