public void GivenSalesOrderWithNoLines_WhenPlacingOrder_ThenShouldThrow() { Scenario.For(Context) .HandledBy(CreateHandler()) .Given(SalesOrderTestDataBuilder.NewOrder()) .When(order => new PlaceSalesOrder(order.Id)) .Throws <InvalidOperationException>() .Assert(); }
public static SalesOrderTestDataBuilder NewOrder() { var salesOrder = new SalesOrder(); salesOrder.Create(Guid.NewGuid()); var builder = new SalesOrderTestDataBuilder(salesOrder); return(builder); }
public void GivenSalesOrderWithSingleOrderLine_WhenPlacingOrder_ThenShouldPlaceOrder() { Scenario.For <SalesOrder>(Context) .HandledBy <PlaceSalesOrderCommandHandler>(CreateHandler()) .Given(SalesOrderTestDataBuilder.NewOrder().WithSingleLineItem()) .When(c => new PlaceSalesOrder(c.Id)) .Then((a, c) => new[] { new SalesOrderPlaced(a.Id) }) .Assert(); }