public Task Delete([FromBody] DeleteNutrientModel model) { this.TryValidateModel(model); var command = new DeleteNutrientById(model.NutrientId); return(this.deleteNutrientByIdHandler.HandleCommandAsync(command)); }
public async Task HandleCommandAsync_WithValidParams_DeletesNutrient() { // Arrange var nutrientId = new Fixture().Create <Guid>(); var command = new DeleteNutrientById(nutrientId); // Act await this.sut.HandleCommandAsync(command); // Assert A.CallTo(() => this.repository.RemoveOneByKeyAsync(nutrientId)) .MustHaveHappenedOnceExactly(); }