コード例 #1
0
 public void GivenSalesOrderWithNoLines_WhenPlacingOrder_ThenShouldThrow()
 {
     Scenario.For(Context)
     .HandledBy(CreateHandler())
     .Given(SalesOrderTestDataBuilder.NewOrder())
     .When(order => new PlaceSalesOrder(order.Id))
     .Throws <InvalidOperationException>()
     .Assert();
 }
コード例 #2
0
        public static SalesOrderTestDataBuilder NewOrder()
        {
            var salesOrder = new SalesOrder();

            salesOrder.Create(Guid.NewGuid());
            var builder = new SalesOrderTestDataBuilder(salesOrder);

            return(builder);
        }
コード例 #3
0
 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();
 }