public async Task Handle_GivenInvalidOperationResult() { //Arrange const int createId = 10; var command = new CreateAuthenticationOptionCommand { AuthenticationOptionId = createId, RouteId = 1 }; //Assert await Assert.ThrowsAsync <InvalidOperationException>(() => _handler.Handle(command, CancellationToken.None)); }
public async Task Handle_GivenValidResult() { //Arrange const int createId = 35; var command = new CreateAuthenticationOptionCommand { AuthenticationOptionId = createId, RouteId = 1 }; //Act await _handler.Handle(command, CancellationToken.None); var unit = await Context.AuthenticationOptions.FindAsync(createId); //Assert Assert.Equal(createId, unit.AuthenticationOptionId); Assert.Equal(1, unit.RouteId); }
public async Task <IActionResult> Create([FromBody] CreateAuthenticationOptionCommand command) { await Mediator.Send(command); return(NoContent()); }