public void RemoveAdministratorSuccessfully()
        {
            tc.PrepareDBForTests();
            Administrator admin = new Administrator("Admin: " + tc.UserTest(), "123");

            admin.Admin_Number = tc.adminFacade.CreateNewAdmin(tc.adminToken, admin);
            tc.adminFacade.RemoveAdministrator(tc.adminToken, admin);
            Assert.AreEqual(tc.adminFacade.GetAdminByUserName(tc.adminToken, admin.User_Name), null);
        }
        public void WrongPasswordWhenTryLoginAsAdmin()
        {
            tc.PrepareDBForTests();
            Administrator admin = new Administrator("Admin" + tc.UserTest(), "9999");

            admin.Admin_Number = tc.adminFacade.CreateNewAdmin(tc.adminToken, admin);
            FlyingCenterSystem.GetUserAndFacade(admin.User_Name, "ErrorPassword", out ILogin token, out FacadeBase facade);
        }
示例#3
0
        public void WrongPasswordWhenTryLoginAsAdmin()
        {
            TestCenter.PrepareDBForTests(out LoginToken <Administrator> adminToken, out LoggedInAdministratorFacade adminFacade);
            Administrator newAdmin = new Administrator {
                User_Name = "Admin" + TestCenter.UserTest(), Password = "******"
            };

            adminFacade.CreateNewAdmin(adminToken, newAdmin);
            FlyingCenterSystem.TryLogin(newAdmin.User_Name, "ErrorPassword", out ILogin token2, out FacadeBase user2);
        }
示例#4
0
        public void GetAdminByUserName()
        {
            TestCenter.PrepareDBForTests(out LoginToken <Administrator> adminToken, out LoggedInAdministratorFacade adminFacade);
            Administrator admin = new Administrator {
                User_Name = TestCenter.UserTest(), Password = "******"
            };

            admin.Id = adminFacade.CreateNewAdmin(adminToken, admin);
            Assert.AreNotEqual(adminFacade.GetAdminByUserName(adminToken, admin.User_Name), null);
        }
示例#5
0
        public void WrongPasswordWhenTryLoginAsAirline()
        {
            TestCenter.PrepareDBForTests(out LoginToken <Administrator> adminToken, out LoggedInAdministratorFacade adminFacade);
            AirlineCompany newAirline = new AirlineCompany {
                Airline_Name = "Flighter", User_Name = "Airline" + TestCenter.UserTest(), Password = "******", Country_Code = adminFacade.GetCountryByName("Israel").Id
            };

            adminFacade.CreateNewAirline(adminToken, newAirline);
            FlyingCenterSystem.TryLogin(newAirline.User_Name, "ErrorPassword", out ILogin token2, out FacadeBase user2);
        }
示例#6
0
        public void RemoveCustomerSuccessfully()
        {
            TestCenter.PrepareDBForTests(out LoginToken <Administrator> adminToken, out LoggedInAdministratorFacade adminFacade);
            Customer CustomerToRemove = new Customer {
                First_Name = "Shiran", Last_Name = "Ben Sadon", User_Name = TestCenter.UserTest(), Password = "******", Address = "Neria 28", Phone_No = "050", Credit_Card_Number = "3317"
            };

            adminFacade.CreateNewCustomer(adminToken, CustomerToRemove);
            adminFacade.RemoveCustomer(adminToken, CustomerToRemove);
            Assert.AreEqual(adminFacade.GetCustomerByUserName(adminToken, CustomerToRemove.User_Name), null);
        }
示例#7
0
        public void RemoveAirlineSuccessfully()
        {
            TestCenter.PrepareDBForTests(out LoginToken <Administrator> adminToken, out LoggedInAdministratorFacade adminFacade);
            AirlineCompany airlineToRemove = new AirlineCompany {
                Airline_Name = "AirlineForRemove", User_Name = TestCenter.UserTest(), Password = "******", Country_Code = adminFacade.GetCountryByName("Israel").Id
            };

            adminFacade.CreateNewAirline(adminToken, airlineToRemove);
            adminFacade.RemoveAirline(adminToken, airlineToRemove);
            Assert.AreEqual(adminFacade.GetAirlineByUserName(adminToken, airlineToRemove.User_Name), null);
        }
示例#8
0
        public void TryRemoveAirlineUserThatNotExist()
        {
            TestCenter.PrepareDBForTests(out LoginToken <Administrator> adminToken, out LoggedInAdministratorFacade adminFacade);
            AirlineCompany airlineToRemove = new AirlineCompany {
                Airline_Name = "AirlineForRemove", User_Name = TestCenter.UserTest(), Password = "******", Country_Code = adminFacade.GetCountryByName("Israel").Id
            };

            adminFacade.CreateNewAirline(adminToken, airlineToRemove);
            airlineToRemove.User_Name = "AirlineWithOtherName";
            adminFacade.RemoveAirline(adminToken, airlineToRemove);
        }
示例#9
0
        public void TryRemoveCustomerUserThatNotExist()
        {
            TestCenter.PrepareDBForTests(out LoginToken <Administrator> adminToken, out LoggedInAdministratorFacade adminFacade);
            Customer CustomerToRemove = new Customer {
                First_Name = "Shiran", Last_Name = "Ben Sadon", User_Name = TestCenter.UserTest(), Password = "******", Address = "Neria 28", Phone_No = "050", Credit_Card_Number = "3317"
            };

            adminFacade.CreateNewCustomer(adminToken, CustomerToRemove);
            CustomerToRemove.User_Name = "CustomerWithOtherName";
            adminFacade.RemoveCustomer(adminToken, CustomerToRemove);
        }
示例#10
0
        public void UpdateCustomer()
        {
            TestCenter.PrepareDBForTests(out LoginToken <Administrator> adminToken, out LoggedInAdministratorFacade adminFacade);
            Customer customerToUpdate = new Customer {
                First_Name = "Shiran", Last_Name = "Ben Sadon", User_Name = TestCenter.UserTest(), Password = "******", Address = "Neria 28", Phone_No = "050", Credit_Card_Number = "3317"
            };

            adminFacade.CreateNewCustomer(adminToken, customerToUpdate);
            customerToUpdate            = adminFacade.GetCustomerByUserName(adminToken, customerToUpdate.User_Name);
            customerToUpdate.First_Name = "CHANGED!";
            adminFacade.UpdateCustomerDetails(adminToken, customerToUpdate);
            Assert.AreEqual(adminFacade.GetCustomerByUserName(adminToken, customerToUpdate.User_Name).First_Name, "CHANGED!");
        }
示例#11
0
        public void UpdateAirline()
        {
            TestCenter.PrepareDBForTests(out LoginToken <Administrator> adminToken, out LoggedInAdministratorFacade adminFacade);
            AirlineCompany airlineToUpdate = new AirlineCompany {
                Airline_Name = "AirlineForUpdate", User_Name = TestCenter.UserTest(), Password = "******", Country_Code = adminFacade.GetCountryByName("Israel").Id
            };

            adminFacade.CreateNewAirline(adminToken, airlineToUpdate);
            airlineToUpdate = adminFacade.GetAirlineByUserName(adminToken, airlineToUpdate.User_Name);
            airlineToUpdate.Airline_Name = "CHANGED!";
            adminFacade.UpdateAirlineDetails(adminToken, airlineToUpdate);
            Assert.AreEqual(adminFacade.GetAirlineByUserName(adminToken, airlineToUpdate.User_Name).Airline_Name, "CHANGED!");
        }
示例#12
0
        public void LoginSuccesfullyAsDAOAdmin()
        {
            TestCenter.PrepareDBForTests(out LoginToken <Administrator> adminToken, out LoggedInAdministratorFacade adminFacade);
            Administrator newAdmin = new Administrator()
            {
                User_Name = "Admin" + TestCenter.UserTest(), Password = "******"
            };

            adminFacade.CreateNewAdmin(adminToken, newAdmin);
            FlyingCenterSystem.TryLogin(newAdmin.User_Name, newAdmin.Password, out ILogin token2, out FacadeBase user2);
            LoginToken <Administrator> newAdminToken = token2 as LoginToken <Administrator>;

            Assert.AreNotEqual(newAdmin, null);
        }
示例#13
0
        public void ChangePasswordForAdministrator()
        {
            TestCenter.PrepareDBForTests(out LoginToken <Administrator> adminToken, out LoggedInAdministratorFacade adminFacade);
            Administrator adminForPassword = new Administrator {
                User_Name = TestCenter.UserTest(), Password = "******"
            };

            adminFacade.CreateNewAdmin(adminToken, adminForPassword);
            FlyingCenterSystem.TryLogin(adminForPassword.User_Name, adminForPassword.Password, out ILogin token, out FacadeBase facade);
            LoginToken <Administrator>  newToken  = token as LoginToken <Administrator>;
            LoggedInAdministratorFacade newFacade = facade as LoggedInAdministratorFacade;

            newFacade.ChangeMyPassword(newToken, "123", "newPassword");
            Assert.AreEqual(newToken.User.Password, "newPassword".ToUpper());
        }
        public void TicketNotMatchWhenTryGetTicketThatNotMatchToCurrentCustomer()
        {
            tc.PrepareDBForTests();
            Customer customer = new Customer("Shiran", "Ben Sadon", tc.UserTest(), "123", "Neria 28", "050", "3317");

            customer.Customer_Number = tc.adminFacade.CreateNewCustomer(tc.adminToken, customer);
            FlyingCenterSystem.GetUserAndFacade(customer.User_Name, "123", out ILogin token, out FacadeBase facade);
            LoginToken <Customer>  newToken  = token as LoginToken <Customer>;
            LoggedInCustomerFacade newfacade = facade as LoggedInCustomerFacade;
            Flight flight = new Flight {
                AirlineCompany_Id = tc.airlineToken.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 = tc.airlineFacade.CreateFlight(tc.airlineToken, flight);
            long newId = tc.customerFacade.PurchaseTicket(tc.customerToken, flight);

            newfacade.GetPurchasedTicketById(newToken, (int)newId);
        }
        public void TicketNotMatchWhenTryGetTicketThatNotMatchToCurrentCustomer()
        {
            tc.PrepareDBForTests();
            AirlineCompany airline = new AirlineCompany("AirlineForUpdate", "Airline " + tc.UserTest(), "123", (int)tc.adminFacade.GetCountryByName("Israel").Id);

            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);
        }
示例#16
0
        public void LoginSuccesfullyAsCustomer()
        {
            TestCenter.PrepareDBForTests(out LoginToken <Administrator> adminToken, out LoggedInAdministratorFacade adminFacade);
            Customer newCustomer = new Customer {
                First_Name = "Shiran", Last_Name = "Ben Sadon", User_Name = "Customer" + TestCenter.UserTest(), Password = "******", Address = "Neria 28", Phone_No = "050", Credit_Card_Number = "3317"
            };

            adminFacade.CreateNewCustomer(adminToken, newCustomer);
            FlyingCenterSystem.TryLogin(newCustomer.User_Name, "123", out ILogin token2, out FacadeBase user2);
            Assert.AreNotEqual(newCustomer, null);
        }
        public void GetAllArlineCompanies()
        {
            tc.PrepareDBForTests();
            AirlineCompany airline = new AirlineCompany("AirlineForUpdate", "Airline " + tc.UserTest(), "123", (int)tc.adminFacade.GetCountryByName("Israel").Id);

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

            Assert.AreEqual(AirlineCompanies.Count, 2);
        }