예제 #1
0
        public void Test_ReadWriteRule_Construct_WithValue_ShouldSetValue()
        {
            //---------------Set up test pack-------------------
            var expecteRwRule = RandomValueGenerator.GetRandomEnum <PropReadWriteRule>();

            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            var attribute = new AutoMapReadWriteRuleAttribute(expecteRwRule);

            //---------------Test Result -----------------------
            Assert.AreEqual(expecteRwRule, attribute.ReadWriteRule);
        }
예제 #2
0
        public void Test_MapWithFake_WhenHasReadWriteAttribute_ShouldReturnPropDefWithAttribute()
        {
            //---------------Set up test pack-------------------
            var wrapper = GetMockPropWrapper();
            var expectedReadWriteRule = RandomValueGenerator.GetRandomEnum <PropReadWriteRule>();

            SetReadWriteAttribute(wrapper, expectedReadWriteRule);
            var propertyAutoMapper = new PropertyAutoMapper(wrapper);

            //---------------Assert Precondition----------------
            Assert.IsNotNull(wrapper.GetAttribute <AutoMapReadWriteRuleAttribute>());
            //---------------Execute Test ----------------------
            var propDef = propertyAutoMapper.MapProperty();

            //---------------Test Result -----------------------
            Assert.IsNotNull(propDef);
            var actualReadWriteRule = propDef.ReadWriteRule;

            Assert.IsNotNull(actualReadWriteRule);
            Assert.AreEqual(expectedReadWriteRule, actualReadWriteRule);
        }