public void WrongPasswordWhenTryLoginAsCustomer() { tc.PrepareDBForTests(); Customer customer = tc.CreateRandomCustomer(); tc.adminFacade.CreateNewCustomer(tc.adminToken, customer); FlyingCenterSystem.GetUserAndFacade(customer.User_Name, "ErrorPassword", out ILogin token, out FacadeBase facade); }
public void RemoveCustomerSuccessfully() { tc.PrepareDBForTests(); Customer customer = tc.CreateRandomCustomer(); customer.Customer_Number = tc.adminFacade.CreateNewCustomer(tc.adminToken, customer); tc.adminFacade.RemoveCustomer(tc.adminToken, customer); Assert.AreEqual(tc.adminFacade.GetCustomerByUserName(tc.adminToken, customer.User_Name).Id, 0); }
public void TestForCustomersController() { tc.PrepareDBForTests(); LoggedInAdministratorFacade adminFacade = new LoggedInAdministratorFacade(); Customer customer = tc.CreateRandomCustomer(); customer.Customer_Number = adminFacade.CreateNewCustomer(FlyingCenterConfig.basicToken, 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 TicketNotMatchWhenTryGetTicketThatNotMatchToCurrentCustomer() { tc.PrepareDBForTests(); Customer customer = tc.CreateRandomCustomer(); customer.Customer_Number = tc.adminFacade.CreateNewCustomer(tc.adminToken, customer); FlyingCenterSystem.GetUserAndFacade(customer.User_Name, "123", out ILogin token, out FacadeBase facade); LoginToken <Customer> newToken = token as LoginToken <Customer>; LoggedInCustomerFacade newfacade = facade as LoggedInCustomerFacade; Flight flight = new Flight { AirlineCompany_Id = tc.airlineToken.User.Id, Departure_Time = new DateTime(2020, 12, 10, 00, 00, 00), Landing_Time = new DateTime(2020, 12, 11), Origin_Country_Code = tc.adminFacade.GetCountryByName("Israel").Id, Destination_Country_Code = tc.adminFacade.GetCountryByName("Israel").Id, Remaining_Tickets = 100 }; flight.Id = tc.airlineFacade.CreateFlight(tc.airlineToken, flight); long newId = tc.customerFacade.PurchaseTicket(tc.customerToken, flight); newfacade.GetPurchasedTicketById(newToken, (int)newId); }