public void RemoveAirline_Test() { FlightCenterSystem.Instance.Login(out FacadeBase facadeBase, out ILoginToken loginToken, "Bar_36", "rvdsgr"); LoginToken <Administrator> token = (LoginToken <Administrator>)loginToken; LoggedInAdministratorFacade facade = (LoggedInAdministratorFacade)facadeBase; AirlineCompany airlineCompany = _airlineDAO.Get(1); facade.RemoveAirline(token, airlineCompany); Assert.AreEqual(_airlineDAO.GetAll().Count, 2); }
public void Get() { countryDAO.Add(new Country("Israel")); airlineDAO.Add(new AirlineCompany(TestData.AirlineDAOMSSQLTests_Get_AirlineName, "ELAL123", "PASSWORD", countryDAO.GetCountryByName("Israel").ID)); Assert.AreEqual(TestData.AirlineDAOMSSQLTests_Get_AirlineName, airlineDAO.Get(airlineDAO.GetAirlineByName("ELAL").ID).AirLineName); Assert.AreEqual("ELAL123", airlineDAO.Get(airlineDAO.GetAirlineByName("ELAL").ID).UserName); Assert.AreEqual("PASSWORD", airlineDAO.Get(airlineDAO.GetAirlineByName("ELAL").ID).Password); Assert.AreEqual(countryDAO.GetCountryByName("Israel").ID, airlineDAO.Get(airlineDAO.GetAirlineByName("ELAL").ID).CountryCode); }
public void UpdateUserDetails_Test() { FlightCenterSystem.Instance.Login(out FacadeBase facadebase, out ILoginToken token, "dana131", "gdfds"); LoginToken <AirlineCompany> loginToken = (LoginToken <AirlineCompany>)token; LoggedInAirlineFacade facade = (LoggedInAirlineFacade)facadebase; User user = new User { Id = loginToken.User.User.Id, User_Name = "dana111", Password = loginToken.User.User.Password, Email = loginToken.User.User.Email, User_Role = loginToken.User.User.User_Role }; _airlineDAO.Get(1).User = user; facade.MofidyAirlineDetails(loginToken, _airlineDAO.Get(1)); Assert.AreEqual(_userDAO.Get(4).User_Name, "dana111"); }
public void ChangeAirlinePassword(LoginToken <AirlineCompany> token, string oldPassword, string newPassword) { var airline = _airlineDAO.Get(token.User.Id); if (airline.Password == oldPassword) { airline.Password = newPassword; _airlineDAO.Update(airline); } else { throw new InvalidOperationException("Incorrect old password provided!"); } }