public void PropertyValueAccessorGetBooleanTest()
        {
            // Arrange
            PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("Boolean");
            var valueAccessor = new PropertyValueAccessor<EntityWithProperties>(propertyInfo);
            const bool value = true;
            var user = new EntityWithProperties { Boolean = value };

            // Act
            EntityProperty entityProperty = valueAccessor.GetValue(user);

            // Assert
            Assert.Equal(entityProperty.BooleanValue, value);
        }
        public void PropertyValueAccessorSetBooleanTest()
        {
            // Arrange
            PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("Boolean");
            var valueAccessor = new PropertyValueAccessor<EntityWithProperties>(propertyInfo);
            var entity = new EntityWithProperties {Boolean = true};
            const bool newValue = false;

            // Act
            valueAccessor.SetValue(entity, new EntityProperty(newValue));

            // Assert
            Assert.Equal(entity.Boolean, newValue);
        }
        public void PropertyValueAccessorSetStringTest()
        {
            // Arrange
            PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("String");
            var valueAccessor = new PropertyValueAccessor<EntityWithProperties>(propertyInfo);
            var entity = new EntityWithProperties { String = "aabbcc" };
            const string newValue = "ccbbaa";

            // Act
            valueAccessor.SetValue(entity, new EntityProperty(newValue));

            // Assert
            Assert.Equal(entity.String, newValue);
        }
        public void PropertyValueAccessorGetNullableInt64Test()
        {
            // Arrange
            PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("NullableInt64");
            var valueAccessor = new PropertyValueAccessor<EntityWithProperties>(propertyInfo);
            Int64? value = 3;
            var user = new EntityWithProperties { NullableInt64 = value };

            // Act
            EntityProperty entityProperty = valueAccessor.GetValue(user);

            // Assert
            Assert.Equal(entityProperty.Int64Value, value);
        }
        public void PropertyValueAccessorSetNullableInt64Test()
        {
            // Arrange
            PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("NullableInt64");
            var valueAccessor = new PropertyValueAccessor<EntityWithProperties>(propertyInfo);
            var entity = new EntityWithProperties { NullableInt64 = null };
            Int64? newValue = 5;

            // Act
            valueAccessor.SetValue(entity, new EntityProperty(newValue));

            // Assert
            Assert.Equal(entity.NullableInt64, newValue);
        }
        public void PropertyValueAccessorGetBinaryTest()
        {
            // Arrange
            PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("Binary");
            var valueAccessor = new PropertyValueAccessor<EntityWithProperties>(propertyInfo);
            var value = new byte[] {0x11, 0x22, 0x33};
            var user = new EntityWithProperties { Binary = value };

            // Act
            EntityProperty entityProperty = valueAccessor.GetValue(user);

            // Assert
            Assert.Equal(entityProperty.BinaryValue, value);
        }
        public void PropertyValueAccessorSetNullableInt32EnumTest()
        {
            // Arrange
            PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("NullableInt32Enum");
            var valueAccessor = new PropertyValueAccessor<EntityWithProperties>(propertyInfo);
            var entity = new EntityWithProperties { NullableInt32Enum = null };
            MyInt32Enum? newValue = MyInt32Enum.NA;

            // Act
            valueAccessor.SetValue(entity, new EntityProperty((Int32?)newValue));

            // Assert
            Assert.Equal(newValue, entity.NullableInt32Enum);
        }
        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);
        }
        public void PropertyValueAccessorSetNullableGuidTest()
        {
            // Arrange
            PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("NullableGuid");
            var valueAccessor = new PropertyValueAccessor<EntityWithProperties>(propertyInfo);
            var entity = new EntityWithProperties { NullableGuid = null };
            Guid? newValue = Guid.NewGuid();

            // Act
            valueAccessor.SetValue(entity, new EntityProperty(newValue));

            // Assert
            Assert.Equal(entity.NullableGuid, newValue);
        }
        public void PropertyValueAccessorSetNullableDoubleTest()
        {
            // Arrange
            PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("NullableDouble");
            var valueAccessor = new PropertyValueAccessor<EntityWithProperties>(propertyInfo);
            var entity = new EntityWithProperties { NullableDouble = 0.3 };
            Double? newValue = 0.5;

            // Act
            valueAccessor.SetValue(entity, new EntityProperty(newValue));

            // Assert
            Assert.Equal(entity.NullableDouble, newValue);
        }
        public void PropertyValueAccessorGetDoubleTest()
        {
            // Arrange
            PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("Double");
            var valueAccessor = new PropertyValueAccessor<EntityWithProperties>(propertyInfo);
            const Double value = 0.3;
            var user = new EntityWithProperties { Double = value };

            // Act
            EntityProperty entityProperty = valueAccessor.GetValue(user);

            // Assert
            Assert.Equal(entityProperty.DoubleValue, value);
        }
        public void PropertyValueAccessorGetNullableDateTimeOffsetTest()
        {
            // Arrange
            PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("NullableDateTimeOffset");
            var valueAccessor = new PropertyValueAccessor<EntityWithProperties>(propertyInfo);
            DateTimeOffset? value = DateTime.UtcNow;
            var user = new EntityWithProperties { NullableDateTimeOffset = value };

            // Act
            EntityProperty entityProperty = valueAccessor.GetValue(user);

            // Assert
            Assert.Equal(entityProperty.DateTimeOffsetValue, value);
        }
        public void PropertyValueAccessorSetNullableDateTimeOffsetTest()
        {
            // Arrange
            PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("NullableDateTimeOffset");
            var valueAccessor = new PropertyValueAccessor<EntityWithProperties>(propertyInfo);
            var entity = new EntityWithProperties { NullableDateTimeOffset = null };
            DateTimeOffset? newValue = DateTime.UtcNow;

            // Act
            valueAccessor.SetValue(entity, new EntityProperty(newValue));

            // Assert
            Assert.Equal(entity.NullableDateTimeOffset, newValue);
        }
        public void PropertyValueAccessorSetDateTimeOffsetTest()
        {
            // Arrange
            PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("DateTimeOffset");
            var valueAccessor = new PropertyValueAccessor<EntityWithProperties>(propertyInfo);
            var entity = new EntityWithProperties { DateTimeOffset = DateTime.Today };
            DateTimeOffset newValue = DateTime.Now;

            // Act
            valueAccessor.SetValue(entity, new EntityProperty(newValue));

            // Assert
            Assert.Equal(entity.DateTimeOffset, newValue);
        }
        public void PropertyValueAccessorGetDateTimeTest()
        {
            // Arrange
            PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("DateTime");
            var valueAccessor = new PropertyValueAccessor<EntityWithProperties>(propertyInfo);
            DateTime value = DateTime.UtcNow;
            var user = new EntityWithProperties { DateTime = value };

            // Act
            EntityProperty entityProperty = valueAccessor.GetValue(user);

            // Assert
            Assert.NotNull(entityProperty.DateTimeOffsetValue);
            Assert.True(entityProperty.DateTimeOffsetValue.HasValue);
            Assert.Equal(entityProperty.DateTimeOffsetValue.Value.DateTime, value);
        }
        public void PropertyValueAccessorGetStringTest()
        {
            // Arrange
            PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("String");
            var valueAccessor = new PropertyValueAccessor<EntityWithProperties>(propertyInfo);
            const string value = "aabbcc";
            var user = new EntityWithProperties { String = value };

            // Act
            EntityProperty entityProperty = valueAccessor.GetValue(user);

            // Assert
            Assert.Equal(entityProperty.StringValue, value);
        }
        public void PropertyValueAccessorGetInt64EnumTest()
        {
            // Arrange
            PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("Int64Enum");
            var valueAccessor = new PropertyValueAccessor<EntityWithProperties>(propertyInfo);
            const MyInt64Enum value = MyInt64Enum.A;
            var user = new EntityWithProperties { Int64Enum = value };

            // Act
            EntityProperty entityProperty = valueAccessor.GetValue(user);

            // Assert
            Assert.Equal((Int64)value, entityProperty.Int64Value);
        }
        public void PropertyValueAccessorGetNullableGuidTest()
        {
            // Arrange
            PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("NullableGuid");
            var valueAccessor = new PropertyValueAccessor<EntityWithProperties>(propertyInfo);
            Guid? value = Guid.NewGuid();
            var user = new EntityWithProperties { NullableGuid = value };

            // Act
            EntityProperty entityProperty = valueAccessor.GetValue(user);

            // Assert
            Assert.Equal(entityProperty.GuidValue, value);
        }
        public void PropertyValueAccessorGetInt32Test()
        {
            // Arrange
            PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("Int32");
            var valueAccessor = new PropertyValueAccessor<EntityWithProperties>(propertyInfo);
            const Int32 value = 3;
            var user = new EntityWithProperties { Int32 = value };

            // Act
            EntityProperty entityProperty = valueAccessor.GetValue(user);

            // Assert
            Assert.Equal(entityProperty.Int32Value, value);
        }
        public void PropertyValueAccessorSetInt64Test()
        {
            // Arrange
            PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("Int64");
            var valueAccessor = new PropertyValueAccessor<EntityWithProperties>(propertyInfo);
            var entity = new EntityWithProperties { Int64 = 2 };
            const Int64 newValue = 5;

            // Act
            valueAccessor.SetValue(entity, new EntityProperty(newValue));

            // Assert
            Assert.Equal(entity.Int64, newValue);
        }
        public void PropertyValueAccessorGetNullableInt32EnumTest()
        {
            // Arrange
            PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("NullableInt32Enum");
            var valueAccessor = new PropertyValueAccessor<EntityWithProperties>(propertyInfo);
            MyInt32Enum? value = MyInt32Enum.NB;
            var user = new EntityWithProperties { NullableInt32Enum = value };

            // Act
            EntityProperty entityProperty = valueAccessor.GetValue(user);

            // Assert
            Assert.Equal((Int32?)value, entityProperty.Int32Value);
        }
        public void PropertyValueAccessorSetByteTest()
        {
            // Arrange
            PropertyInfo propertyInfo = typeof(EntityWithProperties).GetProperty("Binary");
            var valueAccessor = new PropertyValueAccessor<EntityWithProperties>(propertyInfo);
            var entity = new EntityWithProperties { Binary = new byte[]{0x11, 0x22, 0x33} };
            var newValue = new byte[] {0x33, 0x22, 0x11};

            // Act
            valueAccessor.SetValue(entity, new EntityProperty(newValue));

            // Assert
            Assert.Equal(entity.Binary, newValue);
        }