Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }