Esempio n. 1
0
        public async Task ManufacturerService_Should_Update_Manufacturer()
        {
            // Arrange
            SetUpUnitOfWork();
            var service = new ManufacturerService(_unitOfWork.Object, _mapper);
            var entity  = new ManufacturerDTO()
            {
                Name = "TestName",
            };

            var newEntity = new ManufacturerDTO()
            {
                Name = "NewTestName",
            };

            await service.CreateAsync(entity);

            await _unitOfWork.Object.SaveAsync();

            // Act
            entity.Name = newEntity.Name;
            await service.UpdateAsync(entity);

            await _unitOfWork.Object.SaveAsync();

            // Assert
            Assert.NotNull(entity);
            Assert.Equal(newEntity.Name, entity.Name);
        }