示例#1
0
        public Task Delete([FromBody] DeleteNutrientModel model)
        {
            this.TryValidateModel(model);

            var command = new DeleteNutrientById(model.NutrientId);

            return(this.deleteNutrientByIdHandler.HandleCommandAsync(command));
        }
示例#2
0
        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();
        }