public void UpdatePropertySuccess() { //Arrange var propertyRepository = new PropertyRepository(_container); var dbContext = _serviceProvider.GetRequiredService <DeviserDbContext>(); var properties = TestDataRepository.GetProperties(); foreach (var item in properties) { propertyRepository.CreateProperty(item); } var propertyToUpdate = propertyRepository.GetProperties().First(); propertyToUpdate.Value = "Updated Value"; //Act var result = propertyRepository.UpdateProperty(propertyToUpdate); //Assert Assert.NotNull(result); Assert.NotEqual(result.Id, Guid.Empty); Assert.True(!string.IsNullOrEmpty(result.Name)); Assert.True(!string.IsNullOrEmpty(result.Label)); Assert.True(propertyToUpdate.Value == result.Value); Assert.True(result.CreatedDate > DateTime.MinValue); Assert.True(result.LastModifiedDate > DateTime.MinValue); //Clean dbContext.Property.RemoveRange(dbContext.Property); }
public void UpdatePropertyFail() { //Arrange var propertyRepository = new PropertyRepository(_container); var dbContext = _serviceProvider.GetRequiredService <DeviserDbContext>(); var properties = TestDataRepository.GetProperties(); //Act var result = propertyRepository.UpdateProperty(null); //Assert Assert.Null(result); //Clean dbContext.Property.RemoveRange(dbContext.Property); }
public void UpdateProperty(PropertyRequest property) { var prop = _mapper.Map <PropertyEntitiy>(property); PropertyRepository.UpdateProperty(prop); }