public void When_AddItemNotPending_ThrowsInvalidStateException(string checkedOutOrCancelled) { IEvent evt = new BasketCheckedOut(id, new List <OrderLine>(), new Address()); if (checkedOutOrCancelled == "cancelled") { evt = new BasketCancelled(id); } InitialEvents.Add(evt); Given(InitialEvents.ToArray()); WhenThrows <AddItemToBasket, InvalidStateException>(new AddItemToBasket(id, productId, "Test Product", 2, 10)); }
public void When_RemoveItemNotPending_ThrowsInvalidStateException(string checkedOutOrCancelled) { IEvent evt = new BasketCheckedOut(id, OrderLines, new Address()); if (checkedOutOrCancelled == "cancelled") { evt = new BasketCancelled(id); } InitialEvents.Add(evt); Given(InitialEvents.ToArray()); WhenThrows <RemoveItemFromBasket, InvalidStateException>(new RemoveItemFromBasket(id, productId, 10)); }
public void When_CheckOutCancelled_ThrowsInvalidStateException() { InitialEvents.Add(new BasketCancelled(id)); Given(InitialEvents.ToArray()); WhenThrows <CheckOutBasket, InvalidStateException>(new CheckOutBasket(id, shippingAddress)); }