public void CancelTicket() { Ticket ticket = customerFacade.GetTicketById(1); customerFacade.CancelTicket(customer_token, ticket); Ticket cancelled_ticket = customerFacade.GetTicketById(1); Assert.IsNull(cancelled_ticket); }
public void CustomerFacade_CancelTicket() { LoggedInCustomerFacade facade = FlyingCenterSystem.GetInstance().Login(TestResource.CUSTOMER_USERNAME, TestResource.CUSTOMER_PASSWORD, out LoginTokenBase login) as LoggedInCustomerFacade; Ticket ticket = facade.GetTicketById(19); facade.CancelTicket(login as LoginToken <Customer>, ticket); }
public void Purchase_And_Get_Ticket() { Execute_Test(() => { Flight flight = customer_facade.GetFlightById(1); int empty_seates_before_purchase = flight.RemainingTickets; Ticket ticket = customer_facade.PurchaseTicket(customer_token, flight); Assert.AreEqual(ticket.Id, 2); Ticket my_ticket = customer_facade.GetTicketById(customer_token, ticket.Id); TestData.CompareProps(ticket, my_ticket, true); flight = customer_facade.GetFlightById(1); int empty_seates_after_purchase = flight.RemainingTickets; Assert.AreEqual(empty_seates_before_purchase - 1, empty_seates_after_purchase); }); }
public void TicketNotMatchWhenTryGetTicketThatNotMatchToCurrentCustomer() { tc.PrepareDBForTests(); Customer customer = new Customer("Shiran", "Ben Sadon", tc.UserTest(), "123", "Neria 28", "050", "3317"); 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.GetTicketById(newToken, (int)newId); }