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