public async Task throws_when_command_has_empty_id(DeleteCalendarItemCommand command) { command.Id = Guid.Empty; var exception = await Record.ExceptionAsync(() => act(command)); exception.ShouldBeOfType(typeof(AwesomeCalendarException)); Assert.Equal(((AwesomeCalendarException)exception).Type, AwesomeCalendarExceptionType.InvalidCommand); }
public async Task throws_when_aggregate_not_found(CreateCalendarItemCommand createCommand, DeleteCalendarItemCommand deleteCommand) { createCommand.EndDate = createCommand.StartDate.AddDays(1); await CreateCommandHandler.HandleAsync(createCommand); var exception = await Record.ExceptionAsync(() => act(deleteCommand)); exception.ShouldBeOfType(typeof(AwesomeCalendarException)); }
async Task act(DeleteCalendarItemCommand command) { await DeleteCommandHandler.HandleAsync(command); }