public void ShouldRequireMinimumFields() { var command = new CreateAmigoCommand(); FluentActions.Invoking(() => SendAsync(command)).Should().Throw <ValidationException>(); }
public async Task ShouldCreateAmigo() { var userId = await RunAsDefaultUserAsync(); var command = new CreateAmigoCommand { Nome = "João da Silva" }; var id = await SendAsync(command); var amigo = await FindAsync <Amigo>(id); amigo.Should().NotBeNull(); amigo.Nome.Should().Be(command.Nome); amigo.CreatedBy.Should().Be(userId); amigo.Created.Should().BeCloseTo(DateTime.Now, 10000); }
public async Task <ActionResult <int> > Create(CreateAmigoCommand command) { return(await Mediator.Send(command)); }