public void GivenNonPendingOrder_WhenCancelled_ShouldFail() { // Arrange var order = new SalesOrder(); order.Open(new SalesOrderId(1), new CustomerId(2), new Address("1 Arnold Lane", "Elsewhere", new PostalCode("EL12", "1YY")), (decimal)7.5); order.Cancel(); // Act / Assert Assert.Throws <InvalidOperationException>(order.Cancel); }
public void GivenOpenOrder_WhenCancelled_ShouldSucceed() { // Arrange var order = new SalesOrder(); order.Open(new SalesOrderId(1), new CustomerId(2), new Address("1 Arnold Lane", "Elsewhere", new PostalCode("EL12", "1YY")), (decimal)7.5); // Act order.Cancel(); // Assert Assert.AreEqual(SalesOrderStatus.Cancelled, order.Status); }