public void Register_a_conference() { var Sut = new SUTClass(); var confdate = DateTime.Today; Sut.RegisterType<Conference>(); Sut.When(x => x.RegisterConference(ConferenceId: "conferences/1", Name: "ExampleConf", StartDate: confdate, MaxSeats: 100)); Sut.Then(x => x.ConferenceRegistered(ConferenceId: "conferences/1", Name: "ExampleConf", StartDate: confdate, MaxSeats: 100)); }
public void Order_seats() { var sut = new SUTClass(); sut.RegisterType<Order>(); sut.RegisterType<Conference>(); sut.RegisterType<ConferenceOrderSaga>(); var startdate = DateTime.Today; sut.Given(x => x.ConferenceRegistered(ConferenceId: "conferences/1", Name: "SomeConf", StartDate: startdate, MaxSeats: 100)); sut.When(x => x.RegisterOrder(ConferenceId: "conferences/1", OrderId: "orders/1", Amount: 10)); sut.Then(x => x.SeatsReserved(ConferenceId: "conferences/1", OrderId: "orders/1", Amount: 10)); }
public void Cancel_order() { var sut = new SUTClass(); sut.RegisterType<Order>(); sut.RegisterType<Conference>(); sut.RegisterType<ConferenceOrderSaga>(); var startDate = DateTime.Today; sut.Given(x => x.ConferenceRegistered(ConferenceId: "conferences/1", Name: "SomeConf", StartDate: startDate, MaxSeats: 100), x => x.OrderRegistered(ConferenceId: "conferences/1", OrderId: "orders/1", Amount: 10), x => x.SeatsReserved(ConferenceId: "conferences/1", OrderId: "orders/1", Amount: 10)); sut.When(x => x.CancelOrder(ConferenceId: "conferences/1", OrderId: "orders/1", Reason: "The reason")); sut.Then(x => x.OrderCancelled(ConferenceId: "conferences/1", OrderId: "orders/1", Reason: "The reason")); }
public void Order_seats_when_not_enough_seats_available_but_some_are_pending() { var sut = new SUTClass(); sut.RegisterType<Order>(); sut.RegisterType<Conference>(); sut.RegisterType<ConferenceOrderSaga>(); var startdate = DateTime.Today; sut.Given(x => x.ConferenceRegistered(ConferenceId: "conferences/1", Name: "SomeConf", StartDate: startdate, MaxSeats: 100), x => x.SeatsReserved(ConferenceId: "conferences/1", OrderId: "orders/1", Amount: 84), x => x.OrderPaid(ConferenceId: "conferences/1", OrderId: "orders/1"), x => x.SeatsReserved(ConferenceId: "conferences/1", OrderId: "orders/2", Amount: 10) ); sut.When(x => x.RegisterOrder(ConferenceId: "conferences/1", OrderId: "orders/3", Amount: 11)); sut.Then(x => x.OrderCancelled(ConferenceId: "conferences/1", OrderId: "orders/3", Reason: "There are currently 16/100 seats left in this conference , but 10 are pending; please try again later.")); }