public void FieldValueAccessorGetBooleanTest()
        {
            // Arrange
            FieldInfo fieldInfo = typeof(EntityWithFields).GetField("Boolean");
            var valueAccessor = new FieldValueAccessor<EntityWithFields>(fieldInfo);
            const bool value = true;
            var user = new EntityWithFields { Boolean = value };

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

            // Assert
            Assert.Equal(entityField.BooleanValue, value);
        }
Exemple #2
0
        public void FieldValueAccessorGetBinaryTest()
        {
            // Arrange
            FieldInfo fieldInfo     = typeof(EntityWithFields).GetField("Binary");
            var       valueAccessor = new FieldValueAccessor <EntityWithFields>(fieldInfo);
            var       value         = new byte[] { 0x11, 0x22, 0x33 };
            var       user          = new EntityWithFields {
                Binary = value
            };

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

            // Assert
            Assert.Equal(entityField.BinaryValue, value);
        }
Exemple #3
0
        public void FieldValueAccessorGetBooleanTest()
        {
            // Arrange
            FieldInfo  fieldInfo     = typeof(EntityWithFields).GetField("Boolean");
            var        valueAccessor = new FieldValueAccessor <EntityWithFields>(fieldInfo);
            const bool value         = true;
            var        user          = new EntityWithFields {
                Boolean = value
            };

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

            // Assert
            Assert.Equal(entityField.BooleanValue, value);
        }
Exemple #4
0
        public void FieldValueAccessorGetStringTest()
        {
            // Arrange
            FieldInfo    fieldInfo     = typeof(EntityWithFields).GetField("String");
            var          valueAccessor = new FieldValueAccessor <EntityWithFields>(fieldInfo);
            const string value         = "aabbcc";
            var          user          = new EntityWithFields {
                String = value
            };

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

            // Assert
            Assert.Equal(entityField.StringValue, value);
        }
Exemple #5
0
        public void FieldValueAccessorGetInt32Test()
        {
            // Arrange
            FieldInfo   fieldInfo     = typeof(EntityWithFields).GetField("Int32");
            var         valueAccessor = new FieldValueAccessor <EntityWithFields>(fieldInfo);
            const Int32 value         = 3;
            var         user          = new EntityWithFields {
                Int32 = value
            };

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

            // Assert
            Assert.Equal(entityField.Int32Value, value);
        }
Exemple #6
0
        public void FieldValueAccessorGetNullableInt64Test()
        {
            // Arrange
            FieldInfo fieldInfo     = typeof(EntityWithFields).GetField("NullableInt64");
            var       valueAccessor = new FieldValueAccessor <EntityWithFields>(fieldInfo);
            Int64?    value         = 3;
            var       user          = new EntityWithFields {
                NullableInt64 = value
            };

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

            // Assert
            Assert.Equal(entityField.Int64Value, value);
        }
Exemple #7
0
        public void FieldValueAccessorGetDoubleTest()
        {
            // Arrange
            FieldInfo    fieldInfo     = typeof(EntityWithFields).GetField("Double");
            var          valueAccessor = new FieldValueAccessor <EntityWithFields>(fieldInfo);
            const Double value         = 0.3;
            var          user          = new EntityWithFields {
                Double = value
            };

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

            // Assert
            Assert.Equal(entityField.DoubleValue, value);
        }
Exemple #8
0
        public void FieldValueAccessorGetNullableGuidTest()
        {
            // Arrange
            FieldInfo fieldInfo     = typeof(EntityWithFields).GetField("NullableGuid");
            var       valueAccessor = new FieldValueAccessor <EntityWithFields>(fieldInfo);
            Guid?     value         = Guid.NewGuid();
            var       user          = new EntityWithFields {
                NullableGuid = value
            };

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

            // Assert
            Assert.Equal(entityField.GuidValue, value);
        }
Exemple #9
0
        public void FieldValueAccessorGetNullableDateTimeOffsetTest()
        {
            // Arrange
            FieldInfo      fieldInfo     = typeof(EntityWithFields).GetField("NullableDateTimeOffset");
            var            valueAccessor = new FieldValueAccessor <EntityWithFields>(fieldInfo);
            DateTimeOffset?value         = DateTime.UtcNow;
            var            user          = new EntityWithFields {
                NullableDateTimeOffset = value
            };

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

            // Assert
            Assert.Equal(entityField.DateTimeOffsetValue, value);
        }
Exemple #10
0
        public void FieldValueAccessorGetDateTimeTest()
        {
            // Arrange
            FieldInfo fieldInfo     = typeof(EntityWithFields).GetField("DateTime");
            var       valueAccessor = new FieldValueAccessor <EntityWithFields>(fieldInfo);
            DateTime  value         = DateTime.UtcNow;
            var       user          = new EntityWithFields {
                DateTime = value
            };

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

            // Assert
            Assert.NotNull(entityField.DateTimeOffsetValue);
            Assert.True(entityField.DateTimeOffsetValue.HasValue);
            Assert.Equal(entityField.DateTimeOffsetValue.Value.DateTime, value);
        }
        public void FieldValueAccessorGetBinaryTest()
        {
            // Arrange
            FieldInfo fieldInfo = typeof(EntityWithFields).GetField("Binary");
            var valueAccessor = new FieldValueAccessor<EntityWithFields>(fieldInfo);
            var value = new byte[] {0x11, 0x22, 0x33};
            var user = new EntityWithFields { Binary = value };

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

            // Assert
            Assert.Equal(entityField.BinaryValue, value);
        }
        public void FieldValueAccessorGetNullableDateTimeOffsetTest()
        {
            // Arrange
            FieldInfo fieldInfo = typeof(EntityWithFields).GetField("NullableDateTimeOffset");
            var valueAccessor = new FieldValueAccessor<EntityWithFields>(fieldInfo);
            DateTimeOffset? value = DateTime.UtcNow;
            var user = new EntityWithFields { NullableDateTimeOffset = value };

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

            // Assert
            Assert.Equal(entityField.DateTimeOffsetValue, value);
        }
        public void FieldValueAccessorGetDateTimeTest()
        {
            // Arrange
            FieldInfo fieldInfo = typeof(EntityWithFields).GetField("DateTime");
            var valueAccessor = new FieldValueAccessor<EntityWithFields>(fieldInfo);
            DateTime value = DateTime.UtcNow;
            var user = new EntityWithFields { DateTime = value };

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

            // Assert
            Assert.NotNull(entityField.DateTimeOffsetValue);
            Assert.True(entityField.DateTimeOffsetValue.HasValue);
            Assert.Equal(entityField.DateTimeOffsetValue.Value.DateTime, value);
        }
        public void FieldValueAccessorGetStringTest()
        {
            // Arrange
            FieldInfo fieldInfo = typeof(EntityWithFields).GetField("String");
            var valueAccessor = new FieldValueAccessor<EntityWithFields>(fieldInfo);
            const string value = "aabbcc";
            var user = new EntityWithFields { String = value };

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

            // Assert
            Assert.Equal(entityField.StringValue, value);
        }
        public void FieldValueAccessorGetNullableInt64Test()
        {
            // Arrange
            FieldInfo fieldInfo = typeof(EntityWithFields).GetField("NullableInt64");
            var valueAccessor = new FieldValueAccessor<EntityWithFields>(fieldInfo);
            Int64? value = 3;
            var user = new EntityWithFields { NullableInt64 = value };

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

            // Assert
            Assert.Equal(entityField.Int64Value, value);
        }
        public void FieldValueAccessorGetInt32Test()
        {
            // Arrange
            FieldInfo fieldInfo = typeof(EntityWithFields).GetField("Int32");
            var valueAccessor = new FieldValueAccessor<EntityWithFields>(fieldInfo);
            const Int32 value = 3;
            var user = new EntityWithFields { Int32 = value };

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

            // Assert
            Assert.Equal(entityField.Int32Value, value);
        }
        public void FieldValueAccessorGetNullableGuidTest()
        {
            // Arrange
            FieldInfo fieldInfo = typeof(EntityWithFields).GetField("NullableGuid");
            var valueAccessor = new FieldValueAccessor<EntityWithFields>(fieldInfo);
            Guid? value = Guid.NewGuid();
            var user = new EntityWithFields { NullableGuid = value };

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

            // Assert
            Assert.Equal(entityField.GuidValue, value);
        }
        public void FieldValueAccessorGetDoubleTest()
        {
            // Arrange
            FieldInfo fieldInfo = typeof(EntityWithFields).GetField("Double");
            var valueAccessor = new FieldValueAccessor<EntityWithFields>(fieldInfo);
            const Double value = 0.3;
            var user = new EntityWithFields { Double = value };

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

            // Assert
            Assert.Equal(entityField.DoubleValue, value);
        }