Пример #1
0
        public void InsertData()
        {
            LoginToken <Administrator> admin = new LoginToken <Administrator>()
            {
                User = new Administrator(0, "Admin", "Test", 3, 0, new Users(0, "admin", "Test", "@", 1))
            };

            LoggedInAdministrator.CreateNewUser(admin, new Users(1, "admin1", "pass", "*****@*****.**", 1));
            LoggedInAdministrator.CreateNewUser(admin, new Users(2, "admin2", "pass", "*****@*****.**", 1));
            LoggedInAdministrator.CreateNewUser(admin, new Users(3, "airline1", "pass", "*****@*****.**", 2));
            LoggedInAdministrator.CreateNewUser(admin, new Users(4, "airline2", "pass", "*****@*****.**", 2));
            LoggedInAdministrator.CreateNewUser(admin, new Users(5, "customer1", "pass", "*****@*****.**", 3));
            LoggedInAdministrator.CreateNewUser(admin, new Users(6, "customer2", "pass", "*****@*****.**", 3));

            LoggedInAdministrator.CreateAdmin(admin, new Administrator(1, "simi", "simi", 2, 1));
            LoggedInAdministrator.CreateAdmin(admin, new Administrator(2, "bibi", "simi", 3, 2));
            LoggedInAdministrator.CreateNewAirline(admin, new AirlineCompanies(1, "airone", 3, 3));
            LoggedInAdministrator.CreateNewAirline(admin, new AirlineCompanies(2, "airtwo", 5, 4));
            LoggedInAdministrator.CreateNewCustomer(admin, new Customers(1, "cus", "tomer", "ytl2", "03-23423400234", "2131313", 5));
            LoggedInAdministrator.CreateNewCustomer(admin, new Customers(2, "cusw", "tomerw", "ytle3", "03-234546234234", "231313113", 6));

            loggedInAirline.CreateFlight(new LoginToken <AirlineCompanies>(), new Flights(1, 1, 3, 6, new DateTime(2021, 03, 26), new DateTime(2021, 04, 26), 10));
            loggedInAirline.CreateFlight(new LoginToken <AirlineCompanies>(), new Flights(2, 2, 5, 2, new DateTime(2021, 01, 17), new DateTime(2021, 04, 17), 23));
            LoggedInAdministrator.CreateNewTicket(admin, new Tickets(1, 1));
            LoggedInAdministrator.CreateNewTicket(admin, new Tickets(2, 2));
        }
        public void CreateNewCustomer_UsernameAlreadybelongsToAnother_ThrowsException()
        {
            LoggedInAdministratorFacade administratorFacade = GetAdministratorFacade("Admin", "9999");
            Customer customer = new Customer("foo", "goo", "coo", "555", "ter", 66464, 654321);

            Assert.ThrowsException <UserAlreadyExistsException>(new Action(() => administratorFacade.CreateNewCustomer(administratorFacade.LoginToken, customer)));
        }
        public TestCenter()
        {
            adminFacade = new LoggedInAdministratorFacade();
            adminToken  = new LoginToken <Administrator> {
                User = new Administrator(FlyingCenterConfig.ADMIN_NAME, FlyingCenterConfig.ADMIN_PASSWORD)
            };

            adminFacade.CreateNewCountry(adminToken, new Country()
            {
                Country_Name = "Israel",
            });


            airlineFacade = new LoggedInAirlineFacade();
            airlineToken  = new LoginToken <AirlineCompany> {
                User = new AirlineCompany("TestAirline", "Airline " + UserTest(), "123", (int)adminFacade.GetCountryByName("Israel").Id)
            };
            adminFacade.CreateNewAirline(adminToken, airlineToken.User);
            airlineToken.User = adminFacade.GetAirlineByUserName(airlineToken.User.User_Name);

            customerFacade = new LoggedInCustomerFacade();
            customerToken  = new LoginToken <Customer> {
                User = new Customer("TestCustomer", "Ben Sadon", UserTest(), "123", "Neria 28", "050", "3317")
            };
            adminFacade.CreateNewCustomer(adminToken, customerToken.User);
            customerToken.User = adminFacade.GetCustomerByUserName(adminToken, customerToken.User.User_Name);
        }
Пример #4
0
        // 3. Read Random Customer From API Web.
        public void ReadCustomersFromAPI(int times)
        {
            int success = 0;

            MainWindow.m_Dispatcher.Invoke(DispatcherPriority.ApplicationIdle, new ThreadStart(new Action(() => ViewModel.Logger.Add("Start Create Customers..."))));
            for (int i = 0; i < times; i++)
            {
                HttpResponseMessage response = client.GetAsync("").Result;
                if (response.IsSuccessStatusCode)
                {
                    APIUser  customerAPI = response.Content.ReadAsAsync <APIUser>().Result;
                    Customer customer    = new Customer(customerAPI.results[0].name.first, customerAPI.results[0].name.last, customerAPI.results[0].login.username, customerAPI.results[0].login.password,
                                                        customerAPI.results[0].location.city, customerAPI.results[0].phone, customerAPI.results[0].cell);
                    customer.Id = adminFacade.CreateNewCustomer(customer);
                    userNamesOfCustomers.Add(customer.User_Name);
                    MainWindow.m_Dispatcher.Invoke(DispatcherPriority.ApplicationIdle, new ThreadStart(new Action(() => ViewModel.Logger[ViewModel.Logger.Count - 1] = $"- {i + 1}/{times} Customers Was Generated.")));
                    success++;
                }
                ViewModel.HowMuchCreated++;
            }
            if (times > 0)
            {
                log.Info($"\n{success} Customers Were Created And {times - success} Failed.\n");
                MainWindow.m_Dispatcher.Invoke(DispatcherPriority.ApplicationIdle, new ThreadStart(new Action(() => ViewModel.Logger.Add($"- Customers Generator Is Over. ({success} Were Created And {times - success} Failed)."))));
            }
            else
            {
                MainWindow.m_Dispatcher.Invoke(DispatcherPriority.ApplicationIdle, new ThreadStart(new Action(() => ViewModel.Logger[ViewModel.Logger.Count - 1] = $"- No Creation Request For Customers.")));
            }
        }
        public IHttpActionResult CreateNewCustomer([FromBody] Customer customer)
        {
            bool   isAuthorized    = false;
            bool   isCreated       = false;
            bool   isAirlineExists = false;
            Action act             = () =>
            {
                isAuthorized = GetInternalLoginTokenInternal <Administrator>(out LoginToken <Administrator> loginTokenAdministrator);

                if (isAuthorized)
                {
                    GenerateUtility_class_UserPasswordAndName(out string nameCrypt, out string passCrypt);
                    isCreated = _loggedInAdministratorFacade.CreateNewCustomer(loginTokenAdministrator, customer, nameCrypt, passCrypt, out isAirlineExists);
                }
            };

            ProcessExceptions(act);
            if (!isAuthorized)
            {
                return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, $"Sorry, but you're not an Administrator. Your accsess is denied.")));
            }

            if (isAirlineExists)
            {
                return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.PreconditionFailed, $"Such a customer (number {customer.ID}) can't be created because it's already exists in the system.")));
            }

            if (!isCreated)
            {
                return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, $"Sorry but the customer with the number {customer.ID} didn't created")));
            }

            return(ResponseMessage(Request.CreateResponse(HttpStatusCode.OK, $"The customer number {customer.ID} has been created sucsessfully.")));
        }
Пример #6
0
        public void CreateNewCustomer_Tets()
        {
            FlightCenterSystem.Instance.Login(out FacadeBase facadeBase, out ILoginToken loginToken, "amir54", "fsdf3");
            LoginToken <Administrator>  token  = (LoginToken <Administrator>)loginToken;
            LoggedInAdministratorFacade facade = (LoggedInAdministratorFacade)facadeBase;
            User user = new User()
            {
                User_Name = "Malka4444",
                Password  = "******",
                Email     = "*****@*****.**",
                User_Role = 3
            };
            Customer customer = new Customer
            {
                First_Name     = "Malka",
                Last_Name      = "Tzion",
                Address        = "Halevi 35",
                Phone_No       = "050-913768",
                Credit_Card_No = "254565414",
                User           = user
            };

            facade.CreateNewCustomer(token, customer);
            Assert.AreEqual(_customerDAO.GetAll().Count, 3);
        }
Пример #7
0
        /// <summary>
        /// Constractor Of Test Center To Create Facade And Token For Basic Users.
        /// </summary>
        public TestCenter()
        {
            adminFacade = new LoggedInAdministratorFacade();
            adminToken  = FlyingCenterConfig.basicToken;

            adminFacade.CreateNewCountry(adminToken, new Country()
            {
                Country_Name = "Israel",
            });


            airlineFacade = new LoggedInAirlineFacade();
            airlineToken  = new LoginToken <AirlineCompany> {
                User = new AirlineCompany(GetRandomNameForTestUsers(), "Airline " + GetRandomNameForTestUsers(), "123", (int)adminFacade.GetCountryByName("Israel").Id)
            };
            adminFacade.CreateNewAirline(adminToken, airlineToken.User);
            airlineToken.User = adminFacade.GetAirlineByUserName(adminToken, airlineToken.User.User_Name);

            customerFacade = new LoggedInCustomerFacade();
            customerToken  = new LoginToken <Customer> {
                User = new Customer("TestCustomer", "Ben Sadon", "Customer" + "Customer" + GetRandomNameForTestUsers(), "123", "Neria 28", "050", "3317")
            };
            adminFacade.CreateNewCustomer(adminToken, customerToken.User);
            customerToken.User = adminFacade.GetCustomerByUserName(adminToken, customerToken.User.User_Name);
        }
        public void AddAndRemoveNewCustomer()
        {
            //log in as admin
            LoginService ls = new LoginService();
            LoginToken <Administrator> loginToken = new LoginToken <Administrator>();

            ls.TryAdminLogin("admin", "admin", out loginToken);
            LoggedInAdministratorFacade administratorFacade = new LoggedInAdministratorFacade();

            //add a customer
            Customer c = new Customer(-1, "a", "a", "testCustomer", "testCustomer", "a", "a", "a");

            administratorFacade.CreateNewCustomer(loginToken, c);

            //login as that customer
            LoginToken <Customer> customerLoginToken = new LoginToken <Customer>();

            ls.TryCustomerLogin("testCustomer", "testCustomer", out customerLoginToken);

            //check if it worked
            Assert.AreEqual("testCustomer", customerLoginToken.User.Username);

            //remove that customer
            administratorFacade.RemoveCustomer(loginToken, customerLoginToken.User);

            //check if that worked
            Assert.IsTrue(!ls.TryCustomerLogin("testCustomer", "testCustomer", out customerLoginToken));
        }
Пример #9
0
        // Create a random amount of customers
        public void CreateRandomCustomers(int randomNum)
        {
            Random          random    = new Random();
            List <Customer> customers = new List <Customer>();

            for (int i = 0; i < randomNum; i++)
            {
                Customer c = new Customer
                {
                    FirstName        = RandomString(true),
                    LastName         = RandomString(true),
                    UserName         = RandomString(true),
                    Password         = RandomPassword(),
                    Address          = RandomString(true),
                    PhoneNumber      = random.Next(10000, 100000).ToString(),
                    CreditCardNumber = random.Next(100000, 999999).ToString(),
                };
                foreach (Customer customer in customers)
                {
                    if (customer.UserName == c.UserName || customer.Password == c.Password || adminF.GetCustomerUserName(adminT, c.UserName) == c.UserName)
                    {
                        i--;
                    }
                    continue;
                }
                adminF.CreateNewCustomer(adminT, c);
                customers.Add(c);
            }
        }
Пример #10
0
        public void DuplicateCustomerDetailsException()
        {
            FlightCenterSystem.Instance.Login(out FacadeBase facadeBase, out ILoginToken loginToken, "amir54", "fsdf3");
            LoginToken <Administrator>  token  = (LoginToken <Administrator>)loginToken;
            LoggedInAdministratorFacade facade = (LoggedInAdministratorFacade)facadeBase;
            User user = new User()
            {
                User_Name = "Malka4444",
                Password  = "******",
                Email     = "*****@*****.**",
                User_Role = 3
            };
            Customer customer = new Customer
            {
                First_Name     = "Malka",
                Last_Name      = "Tzion",
                Address        = "Halevi 35",
                Phone_No       = "050-913768",
                Credit_Card_No = "757222821",
                User_Id        = 19,
                User           = user
            };

            facade.CreateNewCustomer(token, customer);
        }
Пример #11
0
        public Customer CreateNewTestCustomer()
        {
            Customer testCustomer = new Customer("jon", "dow", "jon", "1234", "alkana", "054555440", "321456");

            adminF.CreateNewCustomer(adminT, testCustomer);
            return(testCustomer);
        }
        public void Create_And_Get_New_Customer()
        {
            Execute_Test(() =>
            {
                Customer demi_customer = TestData.Get_Customers_Data()[0];
                long customer_id       = administrator_facade.CreateNewCustomer(administrator_token, demi_customer);
                Assert.AreEqual(customer_id, 1);
                demi_customer.Id          = customer_id;
                Customer customer_from_db = administrator_facade.GetCustomerById(administrator_token, customer_id);

                TestData.CompareProps(customer_from_db, demi_customer);
            });
        }
Пример #13
0
        public void LowestLevellAdminTriesToCreateNewCustomerException()
        {
            FlightCenterSystem.Instance.Login(out FacadeBase facadeBase, out ILoginToken loginToken, "roey123", "12345");
            LoginToken <Administrator>  token  = (LoginToken <Administrator>)loginToken;
            LoggedInAdministratorFacade facade = (LoggedInAdministratorFacade)facadeBase;

            facade.CreateNewCustomer(token, new Customer());
        }
Пример #14
0
 private void FillCustomerTableRandomly(Random rnd, int CustomersNo)
 {
     for (int i = 0; i < CustomersNo; i++)
     {
         Customer customerModel = new Customer()
         {
             FirstName        = RandomString(5),
             LastName         = RandomString(5),
             Username         = RandomString(5),
             Password         = RandomString(5),
             Address          = RandomString(5),
             PhoneNo          = rnd.Next(10000, 100000).ToString(),
             CreditCardNumber = rnd.Next(1000, 10000).ToString()
         };
         administratorFacade.CreateNewCustomer(loginTokenAdministrator, customerModel);
     }
 }
Пример #15
0
        public void NullUserTriesToAddNewCustomerException()
        {
            FlightCenterSystem.Instance.Login(out FacadeBase facadeBase, out ILoginToken loginToken, "amir54", "fsdf3");
            LoginToken <Administrator>  token  = (LoginToken <Administrator>)loginToken;
            LoggedInAdministratorFacade facade = (LoggedInAdministratorFacade)facadeBase;

            facade.CreateNewCustomer(null, new Customer());
        }
        private void Init_Customer_Facade_Data()
        {
            _logger.Debug($"Start Init Customer Tests Data");

            string username = "******";
            string password = "******";

            system.TryLogin(username, password, out ILoginToken admin_token, out FacadeBase admin_facade);
            LoggedInAdministratorFacade loggedInAdministratorFacade = admin_facade as LoggedInAdministratorFacade;
            LoginToken <Administrator>  adminLoginToken             = admin_token as LoginToken <Administrator>;
            int country_id = loggedInAdministratorFacade.CreateNewCountry(adminLoginToken, TestData.Get_Countries_Data()[0]);

            loggedInAdministratorFacade.CreateNewCountry(adminLoginToken, TestData.Get_Countries_Data()[1]);
            loggedInAdministratorFacade.CreateNewCountry(adminLoginToken, TestData.Get_Countries_Data()[2]);
            loggedInAdministratorFacade.CreateNewCustomer(adminLoginToken, TestData.Get_Customers_Data()[0]);
            loggedInAdministratorFacade.CreateNewCustomer(adminLoginToken, TestData.Get_Customers_Data()[1]);

            AirlineCompany airlineCompany = TestData.Get_AirlineCompanies_Data()[0];

            airlineCompany.CountryId = country_id;
            loggedInAdministratorFacade.CreateNewAirlineCompany(adminLoginToken, airlineCompany);
            system.TryLogin(airlineCompany.User.UserName, airlineCompany.User.Password, out ILoginToken airline_token, out FacadeBase airline_facade);
            LoggedInAirlineFacade       loggedInAirlineFacade = airline_facade as LoggedInAirlineFacade;
            LoginToken <AirlineCompany> airlineLoginToken     = airline_token as LoginToken <AirlineCompany>;
            Flight flight  = TestData.Get_Flights_Data()[3];
            Flight flight2 = TestData.Get_Flights_Data()[4];
            Flight flight3 = TestData.Get_Flights_Data()[5];

            long flight_id  = loggedInAirlineFacade.CreateFlight(airlineLoginToken, flight);
            long flight_id2 = loggedInAirlineFacade.CreateFlight(airlineLoginToken, flight2);
            long flight_id3 = loggedInAirlineFacade.CreateFlight(airlineLoginToken, flight3);

            flight.Id  = flight_id;
            flight2.Id = flight_id2;
            flight3.Id = flight_id3;

            system.TryLogin(TestData.Get_Customers_Data()[1].User.UserName, TestData.Get_Customers_Data()[1].User.Password, out ILoginToken token, out FacadeBase facade);
            LoginToken <Customer>  cust_token  = token as LoginToken <Customer>;
            LoggedInCustomerFacade cust_facade = facade as LoggedInCustomerFacade;

            cust_facade.PurchaseTicket(cust_token, flight);

            Login(TestData.Get_Customers_Data()[0].User.UserName, TestData.Get_Customers_Data()[0].User.Password);

            _logger.Debug($"End Init Customer Tests Data");
        }
Пример #17
0
        public Customer CreateCustomerForTests()
        {
            Customer c = new Customer("Amity", "Nissimov", "amity9464", "123456789", "Givat-Ada", "054-3018582", "9999-9999-9999-9999");

            c.ID = 1;
            adminFacade.CreateNewCustomer(adminToken, c);
            return(c);
        }
Пример #18
0
        public void CreateNewCustomer()
        {
            Customers c = new Customers(3, "Daniel", "Gidon", "B Street", "000-0000000", "0000-0000-0000-0000", 1);

            loggedInAdministrator.CreateNewCustomer(admin, c);
            Customers c_expected = loggedInAdministrator.GetCustomerById(admin, 3);

            Assert.AreEqual(c_expected, c);
        }
        public void CreateCustomer()
        {
            Customer additionalCustomer = new Customer("2customer_first_name", "2customer_last_name", "2customer_address", "2customer_phone_no", "2customer_credit_card_no", 4);

            additionalCustomer.Id = 2;
            administratorFacade.CreateNewCustomer(admin_token, additionalCustomer);
            Customer second_customer = administratorFacade.GetCustomerById(1);

            Assert.AreNotEqual(additionalCustomer, second_customer);
        }
        public IHttpActionResult CreateNewCustomer([FromBody] Customer customer)
        {
            var loginToken = GetLoginToken();

            if (loginToken == null)
            {
                return(Unauthorized());
            }
            _facade.CreateNewCustomer(loginToken, customer);
            return(Ok());
        }
        public void CreateNewCustomer_AllParametersLegal()
        {
            LoggedInAdministratorFacade administratorFacade = GetAdministratorFacade("Admin", "9999");
            Customer customer = new Customer("foo", "goo", "bek", "555", "ter", 66464, 654321);

            administratorFacade.CreateNewCustomer(administratorFacade.LoginToken, customer);
            int facadeIndex = UserLogin("bek", "555");
            LoggedInCustomerFacade customerFacade = (LoggedInCustomerFacade)FlyingCenterSystem.FacadeList[facadeIndex];

            Assert.IsNotNull(customerFacade.LoginToken);
        }
Пример #22
0
 // Create And Log As Customer For The Tests.
 static public void CreateAndLogAsCustomer(out LoginToken <Customer> token, out LoggedInCustomerFacade facade)
 {
     facade = new LoggedInCustomerFacade();
     token  = new LoginToken <Customer> {
         User = new Customer {
             First_Name = "TestCustomer", Last_Name = "Cohen", User_Name = UserTest(), Password = "******", Address = "Ashkelon", Phone_No = "05411111111", Credit_Card_Number = "34233423"
         }
     };
     defaultFacade.CreateNewCustomer(defaultToken, token.User);
     token.User = defaultFacade.GetCustomerByUserName(defaultToken, token.User.User_Name);
 }
        public IHttpActionResult CreateNewCustomer([FromBody] Customer customer)
        {
            GetLoginToken();

            if (AdminToken != null)
            {
                F.CreateNewCustomer(AdminToken, customer);
                return(Ok($"{ customer.UserName} has been created"));
            }

            return(NotFound());
        }
Пример #24
0
        public IActionResult CreateNewCustomer([FromBody] Customer customer)
        {
            IActionResult result = SafeExecute(() =>
            {
                int facadeIndex = RetriveFacadeIndex();
                LoggedInAdministratorFacade administratorFacade = (LoggedInAdministratorFacade)FlyingCenterSystem.FacadeList[facadeIndex];
                administratorFacade.CreateNewCustomer(administratorFacade.LoginToken, customer);
                return(Ok());
            });

            return(result);
        }
Пример #25
0
        public async Task <ActionResult <Customer> > CreateNewCustomer([FromBody] Customer customer)
        {
            FlightsCenterSystem.GetInstance().login(GetLoginToken().Name, GetLoginToken().Password,
                                                    out LoginToken <Object> l, out FacadeBase f);
            facade      = f as LoggedInAdministratorFacade;
            token_admin = GetLoginToken();
            User u = new UserDAOPGSQL().GetAll().FirstOrDefault(_ => _.Password == token_admin.Password && _.Username == token_admin.Name);

            token_admin.User = new AdministratorDAOPGSQL().GetAll().FirstOrDefault(_ => _.User_id == u.Id);
            await Task.Run(() => facade.CreateNewCustomer(token_admin, customer));

            return(StatusCode(200, customer));
        }
        public void TestForCustomersController()
        {
            LoggedInAdministratorFacade adminFacade = new LoggedInAdministratorFacade();
            Customer customer = CreateRandomCustomer();

            customer.Customer_Number = adminFacade.CreateNewCustomer(customer);
            string   customerToken       = GetTokenAsync(new User(customer.User_Name, customer.Password, UserType.Customer));
            Customer afterUpdateCustomer = new Customer(customer.Customer_Number, customer.Id, "Changed", "Changed", "Changed", "Changed", "Changed", "Changed", "Changed");

            UpdateDetailsForCustomer(customerToken, updateCustomerDetailsUrl, afterUpdateCustomer);
            customer = adminFacade.GetCustomerById(FlyingCenterConfig.basicToken, (int)customer.Id);
            Assert.AreEqual(afterUpdateCustomer.First_Name, customer.First_Name);
        }
        public void getTokenAndGetFacade(out LoginToken <Admin> tokenAdmin, out LoggedInAdministratorFacade facadeAdmin,
                                         out LoginToken <Customer> tokenCustomer, out LoggedInCustomerFacade fasadeCustomer)
        {
            ILoginService loginService = new LoginService();

            loginService.TryAdminLogin(FlightCenterConfig.ADMIN_NAME, FlightCenterConfig.ADMIN_PASSWORD, out tokenAdmin);
            facadeAdmin = FlightsCenterSystem.GetInstance().GetFacade(tokenAdmin) as LoggedInAdministratorFacade;

            facadeAdmin.CreateNewCustomer(tokenAdmin, CreateCustomerForTest());
            tokenCustomer = new LoginToken <Customer>()
            {
                User = facadeAdmin.GetAllCustomers(tokenAdmin)[0]
            };
            fasadeCustomer = FlightsCenterSystem.GetInstance().GetFacade(tokenCustomer) as LoggedInCustomerFacade;
        }
Пример #28
0
        private void GenerateCostumers(LoggedInAdministratorFacade facade, LoginToken <Administrator> loginToken)
        {
            List <Customer> customers = new List <Customer>();

            Converters.ConvertToCustomer(RandomUsers, customers, CustomersAmount);
            for (int i = 0; i < customers.Count; i++)
            {
                try
                {
                    facade.CreateNewCustomer(loginToken, customers[i]);
                }
                catch (Exception e)
                {
                    MessageBox.Show($"Username {customers[i].Username} already exists", "Generator Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
Пример #29
0
        private void Init_Anonymous_Data()
        {
            _logger.Debug($"Start Init Anonymous Tests Data");

            TestsDAOPGSQL.ClearDB();
            string username = "******";
            string password = "******";

            system.TryLogin(username, password, out ILoginToken admin_token, out FacadeBase admin_facade);
            LoggedInAdministratorFacade loggedInAdministratorFacade = admin_facade as LoggedInAdministratorFacade;
            LoginToken <Administrator>  adminLoginToken             = admin_token as LoginToken <Administrator>;
            int country_id = loggedInAdministratorFacade.CreateNewCountry(adminLoginToken, TestData.Get_Countries_Data()[0]);

            loggedInAdministratorFacade.CreateNewCountry(adminLoginToken, TestData.Get_Countries_Data()[1]);
            loggedInAdministratorFacade.CreateNewCountry(adminLoginToken, TestData.Get_Countries_Data()[2]);
            loggedInAdministratorFacade.CreateNewCustomer(adminLoginToken, TestData.Get_Customers_Data()[0]);
            AirlineCompany airlineCompany = TestData.Get_AirlineCompanies_Data()[0];

            airlineCompany.CountryId = country_id;
            loggedInAdministratorFacade.CreateNewAirlineCompany(adminLoginToken, airlineCompany);
            system.TryLogin(TestData.Get_AirlineCompanies_Data()[0].User.UserName, TestData.Get_AirlineCompanies_Data()[0].User.Password, out ILoginToken token, out FacadeBase facade);
            LoginToken <AirlineCompany> airline_token  = token as LoginToken <AirlineCompany>;
            LoggedInAirlineFacade       airline_facade = facade as LoggedInAirlineFacade;
            Flight flight  = TestData.Get_Flights_Data_For_Anonymous_Tests()[0];
            Flight flight2 = TestData.Get_Flights_Data_For_Anonymous_Tests()[1];
            Flight flight3 = TestData.Get_Flights_Data_For_Anonymous_Tests()[2];
            Flight flight4 = TestData.Get_Flights_Data_For_Anonymous_Tests()[3];
            Flight flight5 = TestData.Get_Flights_Data_For_Anonymous_Tests()[4];
            Flight flight6 = TestData.Get_Flights_Data_For_Anonymous_Tests()[5];

            long flight_id  = airline_facade.CreateFlight(airline_token, flight);
            long flight_id2 = airline_facade.CreateFlight(airline_token, flight2);
            long flight_id3 = airline_facade.CreateFlight(airline_token, flight3);
            long flight_id4 = airline_facade.CreateFlight(airline_token, flight4);
            long flight_id5 = airline_facade.CreateFlight(airline_token, flight5);
            long flight_id6 = airline_facade.CreateFlight(airline_token, flight6);

            flight.Id  = flight_id;
            flight2.Id = flight_id2;
            flight3.Id = flight_id3;
            flight4.Id = flight_id4;
            flight5.Id = flight_id5;
            flight6.Id = flight_id6;

            _logger.Debug($"End Init Anonymous Tests Data");
        }
        public void InsertData()
        {
            LoginToken <Administrator> adminToken = new LoginToken <Administrator>()
            {
                User = new Administrator("admin", "monro", 3, 500)
            };

            administratorFacade.CreateUser(adminToken, new User("admin_username", "admin_password", "admin_email", 1));
            administratorFacade.CreateUser(adminToken, new User("airline_username", "airline_passsword", "airline_email", 2));
            administratorFacade.CreateUser(adminToken, new User("customer_username", "customer_password", "customer_email", 3));

            administratorFacade.CreateAdmin(adminToken, new Administrator("adminfirst_name", "admin_last_name", 3, 1));
            administratorFacade.CreateNewAirline(adminToken, new AirlineCompany("airline_name", 3, 2));
            administratorFacade.CreateNewCustomer(adminToken, new Customer("customer_first_name", "customer_last_name", "customer_address", "customer_phone_no", "customer_credit_card_no", 3));

            airlineFacade.CreateFlight(new LoginToken <AirlineCompany>(), new Flight(1, 1, 1, new DateTime(2000, 01, 01), new DateTime(2000, 01, 01), 1));
            administratorFacade.CreateTicket(adminToken, new Ticket(1, 1));
        }