public async Task EditUnknownTodo() { var command = new Example.Todo.Commands.Edit { TodoId = Context.Id(), Message = "test2" }; var ex = await Record.ExceptionAsync(() => Sut.Handle(command, Context)).ConfigureAwait(false); ex.Should().BeOfType <Aggregates.Exceptions.NotFoundException>(); }
public async Task HandleEditTodo() { 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.Edit { TodoId = Context.Id(), Message = "test2" }; await Sut.Handle(command, Context).ConfigureAwait(false); Context.UoW .Check <Example.Todo.Todo>(Context.Id()) .Raised <Example.Todo.Events.Edited>(); }