public void If_Schedule_is_dependent_on_an_event_with_no_ETag_then_it_sets_one() { var scheduler = new ImmediateCommandScheduler <CustomerAccount>(new InMemoryEventSourcedRepository <CustomerAccount>()); var created = new Order.Created { AggregateId = Any.Guid(), ETag = null }; scheduler.Schedule( Any.Guid(), new SendOrderConfirmationEmail(Any.Word()), deliveryDependsOn: created); created.ETag.Should().NotBeNullOrEmpty(); }
public void If_Schedule_is_dependent_on_an_event_with_no_aggregate_id_then_it_throws() { var scheduler = new ImmediateCommandScheduler <CustomerAccount>(new InMemoryEventSourcedRepository <CustomerAccount>()); Action schedule = () => scheduler.Schedule( Any.Guid(), new SendOrderConfirmationEmail(Any.Word()), deliveryDependsOn: new Order.Created { AggregateId = Guid.Empty, ETag = Any.Word() }); schedule.ShouldThrow <ArgumentException>() .And .Message .Should().Contain("An AggregateId must be set on the event on which the scheduled command depends."); }
public void If_Schedule_is_dependent_on_an_event_with_no_ETag_then_it_sets_one() { var scheduler = new ImmediateCommandScheduler<CustomerAccount>(new InMemoryEventSourcedRepository<CustomerAccount>()); var created = new Order.Created { AggregateId = Any.Guid(), ETag = null }; scheduler.Schedule( Any.Guid(), new SendOrderConfirmationEmail(Any.Word()), deliveryDependsOn: created); created.ETag.Should().NotBeNullOrEmpty(); }
public void If_Schedule_is_dependent_on_an_event_with_no_aggregate_id_then_it_throws() { var scheduler = new ImmediateCommandScheduler<CustomerAccount>(new InMemoryEventSourcedRepository<CustomerAccount>()); Action schedule = () => scheduler.Schedule( Any.Guid(), new SendOrderConfirmationEmail(Any.Word()), deliveryDependsOn: new Order.Created { AggregateId = Guid.Empty, ETag = Any.Word() }); schedule.ShouldThrow<ArgumentException>() .And .Message .Should().Contain("An AggregateId must be set on the event on which the scheduled command depends."); }