Example #1
0
        public void ApplyTransform_StringField_AmountAppendedToProperty()
        {
            var amount = 10;
            var record = new MockRecord()
            {
                StringField = "10"
            };
            var property     = typeof(MockRecord).GetProperty(nameof(MockRecord.StringField));
            var addAttribute = new AddAttribute(amount);

            addAttribute.ApplyTransform(property, record);

            Assert.AreEqual("1010", record.StringField);
        }
Example #2
0
        public void ApplyTransform_NullableDecimalField_AmountAddedToProperty()
        {
            var amount = 10;
            var record = new MockRecord()
            {
                NullableDecimalField = 10
            };
            var property     = typeof(MockRecord).GetProperty(nameof(MockRecord.NullableDecimalField));
            var addAttribute = new AddAttribute(amount);

            addAttribute.ApplyTransform(property, record);

            Assert.AreEqual(20, record.NullableDecimalField);
        }
Example #3
0
        public void ApplyTransform_NullValueWithNullableDoubleField_AmountAddedToProperty()
        {
            var amount = 10;
            var record = new MockRecord()
            {
                NullableDoubleField = null
            };
            var property     = typeof(MockRecord).GetProperty(nameof(MockRecord.NullableDoubleField));
            var addAttribute = new AddAttribute(amount);

            addAttribute.ApplyTransform(property, record);

            Assert.IsNull(record.NullableDoubleField);
        }