public async Task <IActionResult> Delete([FromRoute] Guid id)
        {
            try
            {
                await manufacturerService.DeleteAsync(id);

                return(Ok());
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
예제 #2
0
        public async Task ManufacturerService_Should_Delete_Manufacturer_Async()
        {
            // Arrange
            SetUpUnitOfWork();
            var service = new ManufacturerService(_unitOfWork.Object, _mapper);
            var entity  = new ManufacturerDTO()
            {
                Name = "TestName",
            };

            entity = await service.CreateAsync(entity);

            await _unitOfWork.Object.SaveAsync();

            // Act
            await service.DeleteAsync(entity.Id);

            await _unitOfWork.Object.SaveAsync();

            // Assert
            Assert.Null(await service.GetAsync(entity.Id));
        }