Ejemplo n.º 1
0
        public void AirlineLoginTest()
        {
            new TestFacade().DeleteAllTables();

            LoginToken <Administrator> token = new LoginToken <Administrator>()
            {
                User = new Administrator()
            };

            new LoggedInAdministratorFacade().CreateNewAirline(token, new AirlineCompany("Air One", "airone", "*****@*****.**", "555", 1));

            // Login
            ILoginService loginService             = new LoginService();
            LoginToken <AirlineCompany> loginToken = new LoginToken <AirlineCompany>();

            // Inserting wrong credntials should return a null token
            loginService.TryAirlineLogin("WrongUserName", "WrongPassword", out loginToken);

            Assert.AreEqual(loginToken, null);

            // Valid login, should return an airline token
            loginService.TryAirlineLogin("airone", "555", out loginToken);

            Assert.AreEqual(loginToken.User.GetType(), new AirlineCompany().GetType());

            FlightCenterSystem fcs = FlightCenterSystem.GetInstance();

            // Getting the facade
            LoggedInAirlineFacade facade = fcs.GetFacade <AirlineCompany>(loginToken) as LoggedInAirlineFacade;

            Assert.AreNotEqual(facade.GetType(), null);
        }
Ejemplo n.º 2
0
 public void Login()
 {
     Assert.AreEqual(facade.GetType(), facade.GetType());
 }