public void PropertyValueAccessorGetInt32EnumTest() { // Arrange PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("Int32Enum"); var valueAccessor = new PropertyValueAccessor <EntityWithProperties>(propertyInfo); const MyInt32Enum value = MyInt32Enum.A; var user = new EntityWithProperties { Int32Enum = value }; // Act EntityProperty entityProperty = valueAccessor.GetValue(user); // Assert Assert.Equal((Int32)value, entityProperty.Int32Value); }
public void PropertyValueAccessorSetInt32EnumTest() { // Arrange PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("Int32Enum"); var valueAccessor = new PropertyValueAccessor <EntityWithProperties>(propertyInfo); var entity = new EntityWithProperties { Int32Enum = MyInt32Enum.A }; const MyInt32Enum newValue = MyInt32Enum.B; // Act valueAccessor.SetValue(entity, new EntityProperty((Int32)newValue)); // Assert Assert.Equal(newValue, entity.Int32Enum); }