Beispiel #1
0
        public void WrongPasswordWhenTryLoginAsAirline()
        {
            tc.PrepareDBForTests();
            AirlineCompany airline = tc.CreateRandomCompany();

            airline.Airline_Number = tc.adminFacade.CreateNewAirline(tc.adminToken, airline);
            FlyingCenterSystem.GetUserAndFacade(airline.User_Name, "ErrorPassword", out ILogin token, out FacadeBase facade);
        }
        public void TestForCompaniesController()
        {
            tc.PrepareDBForTests();
            LoggedInAdministratorFacade adminFacade = new LoggedInAdministratorFacade();
            AirlineCompany company = tc.CreateRandomCompany();

            adminFacade.CreateNewAirline(FlyingCenterConfig.basicToken, company);
            string companyToken = GetTokenAsync(new User(company.User_Name, company.Password, UserType.Airline));

            CreateFlight(companyToken, CreateFlightUrl, new Flight(company.Id, (int)adminFacade.GetCountryByName("Israel").Id, (int)adminFacade.GetCountryByName("Israel").Id, DateTime.Now, DateTime.Now + TimeSpan.FromHours(3), 150));
            IList <Flight> flights = GetAllFlightsForCurrentCompany(companyToken, GetAllFlightsUrl);

            Assert.AreNotEqual(flights, null);
            Assert.AreEqual(flights.Count, 1);
        }
Beispiel #3
0
        public void GetAllArlineCompanies()
        {
            tc.PrepareDBForTests();
            AirlineCompany airline = tc.CreateRandomCompany();

            airline.Id = tc.adminFacade.CreateNewAirline(tc.adminToken, airline);
            IList <AirlineCompany> AirlineCompanies = new AnonymousUserFacade().GetAllAirlineCompanies();

            Assert.AreEqual(AirlineCompanies.Count, 2);
        }
Beispiel #4
0
        public void RemoveAirlineSuccessfully()
        {
            tc.PrepareDBForTests();
            AirlineCompany airline = tc.CreateRandomCompany();

            airline.Airline_Number = tc.adminFacade.CreateNewAirline(tc.adminToken, airline);
            tc.adminFacade.RemoveAirline(tc.adminToken, airline);
            Assert.AreEqual(tc.adminFacade.GetAdminByUserName(tc.adminToken, airline.User_Name).Id, 0);
        }
Beispiel #5
0
        public void TicketNotMatchWhenTryGetTicketThatNotMatchToCurrentCustomer()
        {
            tc.PrepareDBForTests();
            AirlineCompany airline = tc.CreateRandomCompany();

            airline.Airline_Number = tc.adminFacade.CreateNewAirline(tc.adminToken, airline);
            FlyingCenterSystem.GetUserAndFacade(airline.User_Name, "123", out ILogin token, out FacadeBase facade);
            LoginToken <AirlineCompany> newToken  = token as LoginToken <AirlineCompany>;
            LoggedInAirlineFacade       newfacade = facade as LoggedInAirlineFacade;
            Flight flight = new Flight {
                AirlineCompany_Id = newToken.User.Id, Departure_Time = new DateTime(2020, 12, 10, 00, 00, 00), Landing_Time = new DateTime(2020, 12, 11), Origin_Country_Code = tc.adminFacade.GetCountryByName("Israel").Id, Destination_Country_Code = tc.adminFacade.GetCountryByName("Israel").Id, Remaining_Tickets = 100
            };

            flight.Id = newfacade.CreateFlight(newToken, flight);
            long   newId  = tc.customerFacade.PurchaseTicket(tc.customerToken, flight);
            Ticket ticket = tc.airlineFacade.GetSoldTicketById(tc.airlineToken, (int)newId);
        }