public void WhenFlightBookingTimesOut() { var startBookingCommand = new StartBookingCommand { CustomerId = 1, TotalTicketAmount = 11000}; Test.Saga<FlightBookerSaga>() .When(s => s.Handle(startBookingCommand)) .ExpectPublish<DegradeCustomerToRegular>(d => d.CustomerId == 2); }
public void WhenFlightBookingTimesOut() { var customerId = 1; var startBookingCommand = new StartBookingCommand { CustomerId = customerId, TotalTicketAmount = 11000 }; NServiceBus.Testing.Test.Saga<FlightBookerSaga>() .When(s => s.Handle(startBookingCommand)) .WhenSagaTimesOut() .ExpectPublish<UpgradeCustomerToVIP>(d => d.CustomerId == customerId); }
public ActionResult Create([Bind(Include = "Id,From,To,Price,NumberOfTickets")] Flight flight) { if (ModelState.IsValid) { db.Flights.Add(flight); db.SaveChanges(); var startBookingCommand = new StartBookingCommand { CustomerId = 1, TotalTicketAmount = flight.Price * flight.NumberOfTickets }; ServiceBus.Bus.Send(startBookingCommand); return RedirectToAction("Index"); } return View(flight); }