Example #1
0
        public void AdminFacadeRemoveAirlineMethod()
        {
            ILoggedInAdministratorFacade adminFacade = (ILoggedInAdministratorFacade)TestConfig.fcs.Login(AirlineProjectConfig.ADMIN_USERNAME, AirlineProjectConfig.ADMIN_PASSWORD, out ILoginToken adminToken);

            adminFacade.CreateNewAirline((LoginToken <Administrator>)adminToken, TestData.airline1);
            adminFacade.RemoveAirline((LoginToken <Administrator>)adminToken, TestData.airline1);

            IAnonymousUserFacade anonymousFacade = (IAnonymousUserFacade)TestConfig.fcs.Login("", "", out ILoginToken anonymousToken);

            Assert.AreEqual(null, anonymousFacade.GetAirlineCompanyById(TestData.airline1.ID));
        }
Example #2
0
        public ActionResult <AirlineCompanyDetailsDTO> GetAirlineCompanyById(long id)
        {
            AirlineCompany airlineCompany = _anonymousUserFacade.GetAirlineCompanyById(id);

            if (airlineCompany == null)
            {
                return(NotFound());
            }

            AirlineCompanyDetailsDTO airlineCompanyDetailsDTO = _mapper.Map <AirlineCompanyDetailsDTO>(airlineCompany);

            return(Ok(airlineCompanyDetailsDTO));
        }
Example #3
0
        public void AirlineFacadeChangeMyPasswordMethod()
        {
            ILoggedInAdministratorFacade adminFacade = (ILoggedInAdministratorFacade)TestConfig.fcs.Login(AirlineProjectConfig.ADMIN_USERNAME, AirlineProjectConfig.ADMIN_PASSWORD, out ILoginToken adminToken);

            adminFacade.CreateNewAirline((LoginToken <Administrator>)adminToken, TestData.airline1);

            ILoggedInAirlineFacade airlineFacade = (ILoggedInAirlineFacade)TestConfig.fcs.Login(TestData.airline1.UserName, TestData.airline1.Password, out ILoginToken airlineToken);

            airlineFacade.ChangeMyPassword((LoginToken <AirlineCompany>)airlineToken, TestData.airline1.Password, "54321");

            IAnonymousUserFacade anonymousFacade = (IAnonymousUserFacade)TestConfig.fcs.Login("testAnonymous", "99999", out ILoginToken anonymousToken);

            Assert.AreEqual("54321", anonymousFacade.GetAirlineCompanyById(TestData.airline1.ID).Password);
        }
Example #4
0
        public void AdminFacadeCreateNewAirlineMethod()
        {
            ILoggedInAdministratorFacade adminFacade = (ILoggedInAdministratorFacade)TestConfig.fcs.Login(AirlineProjectConfig.ADMIN_USERNAME, AirlineProjectConfig.ADMIN_PASSWORD, out ILoginToken adminToken);

            adminFacade.CreateNewAirline((LoginToken <Administrator>)adminToken, TestData.airline1);

            IAnonymousUserFacade anonymousFacade = (IAnonymousUserFacade)TestConfig.fcs.Login("", "", out ILoginToken anonymousToken);
            AirlineCompany       actualAirline   = anonymousFacade.GetAirlineCompanyById(TestData.airline1.ID);

            Assert.AreEqual(TestData.airline1.ID, actualAirline.ID);
            Assert.AreEqual(TestData.airline1.AirlineName, actualAirline.AirlineName);
            Assert.AreEqual(TestData.airline1.UserName, actualAirline.UserName);
            Assert.AreEqual(TestData.airline1.Password, actualAirline.Password);
            Assert.AreEqual(TestData.airline1.CountryCode, actualAirline.CountryCode);
        }
        public void AdminFacadeUpdateAirlineDetailsMethod()
        {
            ILoggedInAdministratorFacade adminFacade = (ILoggedInAdministratorFacade)TestConfig.fcs.Login(AirlineProjectConfig.TEST_ADMIN_USERNAME, AirlineProjectConfig.TEST_ADMIN_PASSWORD, out ILoginToken adminToken);

            adminFacade.CreateNewAirline((LoginToken <Administrator>)adminToken, TestData.airline1);
            AirlineCompany updatedAirline = new AirlineCompany(TestData.airline1.ID, "Alpho", "AlphoUser", "AlphoPass", TestData.argentinaID);

            adminFacade.UpdateAirlineDetails((LoginToken <Administrator>)adminToken, updatedAirline);

            IAnonymousUserFacade anonymousFacade = (IAnonymousUserFacade)TestConfig.fcs.Login("testAnonymous", "99999", out ILoginToken anonymousToken);
            AirlineCompany       actualAirline   = anonymousFacade.GetAirlineCompanyById(TestData.airline1.ID);

            Assert.AreEqual(updatedAirline.ID, actualAirline.ID);
            Assert.AreEqual(updatedAirline.AirlineName, actualAirline.AirlineName);
            Assert.AreEqual(updatedAirline.UserName, actualAirline.UserName);
            Assert.AreEqual(updatedAirline.Password, actualAirline.Password);
            Assert.AreEqual(updatedAirline.CountryCode, actualAirline.CountryCode);
        }