Example #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 CreateNewAirline_UsernameAlreadybelongsToAnother_ThrowsException()
        {
            LoggedInAdministratorFacade administratorFacade = GetAdministratorFacade("Admin", "9999");
            AirlineCompany airlineCompany = new AirlineCompany("zem", "coo", "5558", 6);

            Assert.ThrowsException <UserAlreadyExistsException>(new Action(() => { administratorFacade.CreateNewAirline(administratorFacade.LoginToken, airlineCompany); }));
        }
Example #3
0
        // 4. Read Random Company From API Web.
        public void ReadCompaniesFromAPI(int times)
        {
            int             success   = 0;
            IList <Country> countries = new AnonymousUserFacade().GetAllCountries();

            MainWindow.m_Dispatcher.Invoke(DispatcherPriority.ApplicationIdle, new ThreadStart(new Action(() => ViewModel.Logger.Add("Start Create Companies..."))));
            for (int i = 0; i < times; i++)
            {
                HttpResponseMessage response = client.GetAsync("").Result;
                if (response.IsSuccessStatusCode)
                {
                    APIUser        companyAPI = response.Content.ReadAsAsync <APIUser>().Result;
                    AirlineCompany airline    = new AirlineCompany(companyAPI.results[0].name.first, companyAPI.results[0].login.username, companyAPI.results[0].login.password,
                                                                   (int)countries[r.Next(countries.Count)].Id);
                    airline.Id = adminFacade.CreateNewAirline(adminToken, airline);
                    userNamesOfCompanies.Add(airline.User_Name);
                    MainWindow.m_Dispatcher.Invoke(DispatcherPriority.ApplicationIdle, new ThreadStart(new Action(() => ViewModel.Logger[ViewModel.Logger.Count - 1] = $"- {i + 1}/{times} Companies Was Generated.")));
                    success++;
                }
                ViewModel.HowMuchCreated++;
            }
            if (times > 0)
            {
                log.Info($"\n{success} Companies Were Created And {times - success} Failed.\n");
                MainWindow.m_Dispatcher.Invoke(DispatcherPriority.ApplicationIdle, new ThreadStart(new Action(() => ViewModel.Logger.Add($"- Companies 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 Companies.")));
            }
        }
        public void CreateNewAirline_NonExistantCountryCode_ThrowsException()
        {
            LoggedInAdministratorFacade administratorFacade = GetAdministratorFacade("Admin", "9999");
            AirlineCompany airlineCompany = new AirlineCompany("zem", "tek", "5558", 9);

            Assert.ThrowsException <SqlException>(new Action(() => administratorFacade.CreateNewAirline(administratorFacade.LoginToken, airlineCompany)));
        }
Example #5
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 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);
        }
Example #7
0
        public void GetAllFlightsThatIsentFullyBooked()
        {
            UserRepository testUr    = new UserRepository("dad", "aes", RolesEnum.admin);
            Admin          testAdmin = new Admin("dav,", "id", 3);

            FlyingCenterSystem.GetInstance().TryLogin(ur.UserName, ur.Password, out ILogin token,
                                                      out FacadeBase facade);
            LoginToken <Admin>          myToken  = token as LoginToken <Admin>;
            LoggedInAdministratorFacade myFacade = facade as LoggedInAdministratorFacade;

            myFacade.CreateNewAdmin(myToken, testUr, testAdmin);
            Country country = new Country("Israel");

            myFacade.CreateNewCountry(myToken, country);
            AirlineCompany airlineCompany = new AirlineCompany("ElALL", 1, country.ID);
            UserRepository airlineTestUr  = new UserRepository("rad", "ass", RolesEnum.airline);

            myFacade.CreateNewAirline(myToken, airlineTestUr, airlineCompany, country);
            Flight flight = new Flight(DateTime.Now, DateTime.Now, 50, airlineCompany.ID, country.ID, country.ID);

            FlyingCenterSystem.GetInstance().TryLogin(airlineTestUr.UserName, airlineTestUr.Password, out ILogin tokenAir,
                                                      out FacadeBase facadeAir);
            LoginToken <AirlineCompany> myTokenair  = tokenAir as LoginToken <AirlineCompany>;
            LoggedInAirlineFacade       myFacadeAir = facadeAir as LoggedInAirlineFacade;

            myFacadeAir.CreateFlight(myTokenair, flight);
            AnonymousUserFacade      anonymousUserFacade = new AnonymousUserFacade();
            Dictionary <Flight, int> flights             = (Dictionary <Flight, int>)anonymousUserFacade.GetAllFlightsVacancy();

            Assert.IsNotNull(flights);
        }
        public IHttpActionResult CreateNewAirline([FromBody] AirlineCompany airline)
        {
            bool   isAuthorized           = false;
            bool   isCreated              = false;
            bool   isAirlineAlreadyExists = false;
            Action act = () =>
            {
                isAuthorized = GetInternalLoginTokenInternal <Administrator>(out LoginToken <Administrator> loginTokenAdministrator);

                if (isAuthorized)
                {
                    GenerateUtility_class_UserPasswordAndName(out string nameCrypt, out string passCrypt);
                    isCreated = _loggedInAdministratorFacade.CreateNewAirline(loginTokenAdministrator, airline, nameCrypt, passCrypt, out isAirlineAlreadyExists);
                }
            };

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

            if (isAirlineAlreadyExists)
            {
                return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, $"This Airline didn't added to the system because it's already exists in it.")));
            }

            if (!isCreated)
            {
                return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, $"Sorry, but this Airline didn't added to the system")));
            }

            return(ResponseMessage(Request.CreateResponse(HttpStatusCode.OK, "The Airline has been added to the system sucsessfully")));
        }
Example #9
0
        // Create a random amount of airlines
        public void CreateRandomAirlineCompanies(int numberOfAirlines)
        {
            Country               randomCountry = new Country();
            IList <Country>       dbCountries   = adminF.GetAllCountries(adminT);
            List <AirLineCompany> airlines      = new List <AirLineCompany>();
            Random random = new Random();

            for (int i = 0; i < numberOfAirlines; i++)
            {
                randomCountry = dbCountries[random.Next(0, dbCountries.Count)];
                AirLineCompany c = new AirLineCompany
                {
                    AirLineName = RandomString(true),
                    UserName    = RandomString(true),
                    Password    = RandomPassword(),
                    CountryCode = randomCountry.ID,
                };
                foreach (AirLineCompany airLine in airlines)
                {
                    if (airLine.UserName == c.UserName || airLine.Password == c.Password || adminF.GetAirlineUserName(adminT, c.UserName) == c.UserName)
                    {
                        i--;
                    }
                }
                airlines.Add(c);
                adminF.CreateNewAirline(adminT, c);
            }
        }
        public void CancelFlight()
        {
            UserRepository testUr    = new UserRepository("dad", "aes", RolesEnum.admin);
            Admin          testAdmin = new Admin("dav,", "id", 3);

            FlyingCenterSystem.GetInstance().TryLogin(ur.UserName, ur.Password, out ILogin token,
                                                      out FacadeBase facade);
            LoginToken <Admin>          myToken  = token as LoginToken <Admin>;
            LoggedInAdministratorFacade myFacade = facade as LoggedInAdministratorFacade;

            myFacade.CreateNewAdmin(myToken, testUr, testAdmin);
            Country country = new Country("Israel");

            myFacade.CreateNewCountry(myToken, country);
            AirlineCompany airlineCompany = new AirlineCompany("ElALL", 1, country.ID);
            UserRepository airlineTestUr  = new UserRepository("rad", "ass", RolesEnum.airline);

            myFacade.CreateNewAirline(myToken, airlineTestUr, airlineCompany, country);
            Flight flight = new Flight(DateTime.Now, DateTime.Now, 50, airlineCompany.ID, country.ID, country.ID);

            FlyingCenterSystem.GetInstance().TryLogin(airlineTestUr.UserName, airlineTestUr.Password, out ILogin tokenAir,
                                                      out FacadeBase facadeAir);
            LoginToken <AirlineCompany> myTokenair  = tokenAir as LoginToken <AirlineCompany>;
            LoggedInAirlineFacade       myFacadeAir = facadeAir as LoggedInAirlineFacade;

            myFacadeAir.CreateFlight(myTokenair, flight);
            myFacadeAir.CancelFlight(myTokenair, flight);
            Flight flight1 = myFacadeAir.GetFlightById(flight.ID);

            Assert.IsNull(flight1);
        }
        public void ChangeMyPassword()
        {
            UserRepository testUr    = new UserRepository("dad", "aes", RolesEnum.admin);
            Admin          testAdmin = new Admin("dav,", "id", 3);

            FlyingCenterSystem.GetInstance().TryLogin(ur.UserName, ur.Password, out ILogin token,
                                                      out FacadeBase facade);
            LoginToken <Admin>          myToken  = token as LoginToken <Admin>;
            LoggedInAdministratorFacade myFacade = facade as LoggedInAdministratorFacade;

            myFacade.CreateNewAdmin(myToken, testUr, testAdmin);
            Country country = new Country("Israel");

            myFacade.CreateNewCountry(myToken, country);
            AirlineCompany airlineCompany = new AirlineCompany("ElALL", 1, country.ID);
            UserRepository airlineTestUr  = new UserRepository("rad", "ass", RolesEnum.airline);

            myFacade.CreateNewAirline(myToken, airlineTestUr, airlineCompany, country);
            Flight flight = new Flight(DateTime.Now, DateTime.Now, 50, airlineCompany.ID, country.ID, country.ID);

            FlyingCenterSystem.GetInstance().TryLogin(airlineTestUr.UserName, airlineTestUr.Password, out ILogin tokenAir,
                                                      out FacadeBase facadeAir);
            LoginToken <AirlineCompany> myTokenair  = tokenAir as LoginToken <AirlineCompany>;
            LoggedInAirlineFacade       myFacadeAir = facadeAir as LoggedInAirlineFacade;
            string pass = airlineTestUr.Password;

            myFacadeAir.ChangeMyPassword(myTokenair, "asd");
            airlineTestUr = myFacade.GetUserRepositoryDetails(myToken, airlineTestUr);
            Assert.AreNotEqual(airlineTestUr.Password, pass);
        }
Example #12
0
        public void NullUserTriesToAddNewAirline()
        {
            FlightCenterSystem.Instance.Login(out FacadeBase facadeBase, out ILoginToken loginToken, "amir54", "fsdf3");
            LoginToken <Administrator>  token  = (LoginToken <Administrator>)loginToken;
            LoggedInAdministratorFacade facade = (LoggedInAdministratorFacade)facadeBase;

            facade.CreateNewAirline(null, new AirlineCompany());
        }
        public void CreateNewAirline()
        {
            AirlineCompanies air = new AirlineCompanies("AirFrance1", 4, 1);

            loggedInAdministrator.CreateNewAirline(admin, air);
            AirlineCompanies air_expected = new AirlineCompanies("AirFrance1", 4, 1);

            Assert.AreEqual(air_expected, air);
        }
        public void CreateAirline()
        {
            AirlineCompany additionalAirline = new AirlineCompany("second_airline_name", 1, 4);

            additionalAirline.Id = 2;
            administratorFacade.CreateNewAirline(admin_token, additionalAirline);
            AirlineCompany second_airline = administratorFacade.GetAirlineById(1);

            Assert.AreNotEqual(additionalAirline, second_airline);
        }
        public async Task <IHttpActionResult> CreateNewAirline([FromBody] AirlineCompany airline)
        {
            facade.CreateNewAirline(token, airline);

            facade.RemoveAirlineFromRegisterQueue(token, airline);

            await SendAirlineRegistrationEmail(airline);

            return(Ok());
        }
Example #16
0
        public AirLineCompany CreateNewTestAirlineCompany()
        {
            Country testCountry = new Country("isreal");

            testCountry.ID = adminF.CreateNewCountry(adminT, testCountry);
            AirLineCompany testAirline = new AirLineCompany("elal", "elal", "4321", testCountry.ID);

            adminF.CreateNewAirline(adminT, testAirline);
            return(testAirline);
        }
        public void TestForAnonymousController()
        {
            LoggedInAdministratorFacade adminFacade = new LoggedInAdministratorFacade();
            AirlineCompany company = CreateRandomCompany();

            company.Airline_Number = adminFacade.CreateNewAirline(FlyingCenterConfig.basicToken, company);
            List <AirlineCompany> companies = GetAllCompanies(getAllCompaniesUrl);

            Assert.IsTrue(companies.Contains(company));
        }
        public IHttpActionResult CreateNewAirline([FromBody] AirlineCompany airline)
        {
            GetLoginToken();

            if (AdminToken != null)
            {
                F.CreateNewAirline(AdminToken, airline);
                return(Ok($"{ airline.UserName} has been created"));
            }
            return(NotFound());
        }
        public void TestForAdminController()
        {
            LoggedInAdministratorFacade facade = FlyingCenterSystem.GetInstance().Login(TestResource.adminName, TestResource.adminPassWord, out LoginTokenBase login) as LoggedInAdministratorFacade;
            AirlineCompany company             = new AirlineCompany("sagitair", "999", "888", 1);

            facade.CreateNewAirline(login as LoginToken <Administrator>, company);

            List <AirlineCompany> companies = GetAllCompanies(GetAllCompaniesUrl);

            Assert.IsTrue(companies.Contains(company));
        }
Example #20
0
 // Create And Log As Airline For The Tests.
 static public void CreateAndLogAsAirline(out LoginToken <AirlineCompany> token, out LoggedInAirlineFacade facade)
 {
     facade = new LoggedInAirlineFacade();
     token  = new LoginToken <AirlineCompany> {
         User = new AirlineCompany {
             Airline_Name = "TestAirline", User_Name = UserTest(), Password = "******", Country_Code = defaultFacade.GetCountryByName("Israel").Id
         }
     };
     defaultFacade.CreateNewAirline(defaultToken, token.User);
     token.User = defaultFacade.GetAirlineByUserName(defaultToken, token.User.User_Name);
 }
        public void CreateNewAirline_AllParametersLegal()
        {
            LoggedInAdministratorFacade administratorFacade = GetAdministratorFacade("Admin", "9999");
            AirlineCompany airlineCompany = new AirlineCompany("zem", "tek", "5558", 6);

            administratorFacade.CreateNewAirline(administratorFacade.LoginToken, airlineCompany);
            int facadeIndex = UserLogin("tek", "5558");
            LoggedInAirlineFacade airlineFacade = (LoggedInAirlineFacade)FlyingCenterSystem.FacadeList[facadeIndex];

            Assert.IsNotNull(airlineFacade.LoginToken);
        }
        public IHttpActionResult CreateNewAirline([FromBody] AirlineCompany airline)
        {
            var loginToken = GetLoginToken();

            if (loginToken == null)
            {
                return(Unauthorized());
            }
            _facade.CreateNewAirline(loginToken, airline);
            return(Ok());
        }
Example #23
0
        public IActionResult CreateNewAirline([FromBody] AirlineCompany airline)
        {
            IActionResult result = SafeExecute(() =>
            {
                int facadeIndex = RetriveFacadeIndex();
                LoggedInAdministratorFacade administratorFacade = (LoggedInAdministratorFacade)FlyingCenterSystem.FacadeList[facadeIndex];
                administratorFacade.CreateNewAirline(administratorFacade.LoginToken, airline);
                return(Ok());
            });

            return(result);
        }
Example #24
0
        public AirlineCompany CreateAirlineCompanyForTests()
        {
            Country c = new Country("Israel");

            c.ID = 1;
            adminFacade.CreateNewCountry(adminToken, c);
            AirlineCompany a = new AirlineCompany("IsraAir", "IsraAirManager", "123456", c.ID);

            a.ID = 1;
            adminFacade.CreateNewAirline(adminToken, a);
            return(a);
        }
Example #25
0
        public async Task <ActionResult <AirlineCompany> > CreateNewAirline([FromBody] AirlineCompany airline)
        {
            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.CreateNewAirline(token_admin, airline));

            return(StatusCode(200, airline));
        }
        public void TestForCompaniesController()
        {
            LoggedInAdministratorFacade adminFacade = new LoggedInAdministratorFacade();
            AirlineCompany company = 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);
        }
        private void GenerateAirlineCompanies(LoggedInAdministratorFacade facade, LoginToken <Administrator> loginToken)
        {
            List <AirlineCompany> airlineCompanies = new List <AirlineCompany>();
            List <Country>        countries        = (List <Country>)facade.GetAllCountries(loginToken);

            Converters.ConvertToAirlineCompany(RandomUsers, airlineCompanies, countries, AirlineCompaniesAmount);
            for (int i = 0; i < airlineCompanies.Count; i++)
            {
                try
                {
                    facade.CreateNewAirline(loginToken, airlineCompanies[i]);
                }
                catch (Exception e)
                {
                    MessageBox.Show($"Username {airlineCompanies[i].Username} already exists", "Generator Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
        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));
        }
        public void TestForAnonymousController()
        {
            LoggedInAdministratorFacade facade = FlyingCenterSystem.GetInstance().Login(TestResource.adminName, TestResource.adminPassWord, out LoginTokenBase login) as LoggedInAdministratorFacade;
            AirlineCompany company             = new AirlineCompany("sagitair", "999", "888", 1);

            facade.CreateNewAirline(login as LoginToken <Administrator>, company);
            using (HttpClient client = new HttpClient())
            {
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                using (HttpResponseMessage response = client.GetAsync(GetAllCompaniesUrl).Result)
                {
                    using (HttpContent content = response.Content)
                    {
                        content.Headers.Equals(company);
                    }
                }
            }
        }
        public IHttpActionResult CreateNewAirlineCompany([FromBody] HTTPAirlineCompany airlineCompany)
        {
            if (airlineCompany.AirlineName == null | airlineCompany.Username == null | airlineCompany.Password == null | airlineCompany.CountryID <= 0)
            {
                return(BadRequest());
            }
            LoginToken <Administrator>  token  = (LoginToken <Administrator>)Request.Properties["User"];
            LoggedInAdministratorFacade facade = (LoggedInAdministratorFacade)(FlyingCenterSystem.GetFlyingCenterSystem().GetFacade(token));

            try
            {
                facade.CreateNewAirline(token, new AirlineCompany(-1, airlineCompany.AirlineName, airlineCompany.Username, airlineCompany.Password, airlineCompany.CountryID));
            }
            catch (UsernameAlreadyExistsException)
            {
                return(StatusCode(HttpStatusCode.Conflict));
            }
            return(Ok());
        }