public async Task HandleMarkComplete() { Context.UoW.Plan <Example.Todo.Todo>(Context.Id()) .HasEvent <Example.Todo.Events.Added>(x => { x.TodoId = Context.Id(); x.Message = "test"; }); var command = new Example.Todo.Commands.MarkComplete { TodoId = Context.Id(), }; await Sut.Handle(command, Context).ConfigureAwait(false); Context.UoW .Check <Example.Todo.Todo>(Context.Id()) .Raised <Example.Todo.Events.MarkedComplete>(); }
public async Task MarkCompleteWhileComplete() { Context.UoW.Plan <Example.Todo.Todo>(Context.Id()) .HasEvent <Example.Todo.Events.Added>(x => { x.TodoId = Context.Id(); x.Message = "test"; }) .HasEvent <Example.Todo.Events.MarkedComplete>(x => { x.TodoId = Context.Id(); }); var command = new Example.Todo.Commands.MarkComplete { TodoId = Context.Id(), }; var ex = await Record.ExceptionAsync(() => Sut.Handle(command, Context)).ConfigureAwait(false); ex.Should().BeOfType <BusinessException>(); }