Example #1
0
        /// <summary>
        /// Configures the specified property info.
        /// </summary>
        /// <param name="propertyInfo">The property info.</param>
        /// <param name="config">The config.</param>
        public void Configure(System.Reflection.PropertyInfo propertyInfo, ChildrenConfiguration config)
        {
            config.InferType = InferType;
            config.IsLazy    = IsLazy;

            base.Configure(propertyInfo, config);
        }
        /// <summary>
        /// Configures the specified property info.
        /// </summary>
        /// <param name="propertyInfo">The property info.</param>
        /// <param name="config">The config.</param>
        public void Configure(System.Reflection.PropertyInfo propertyInfo, ChildrenConfiguration config)
        {
            config.InferType = InferType;
            config.IsLazy = IsLazy;

            base.Configure(propertyInfo, config);
        }
        public void Configure_IsLazyByDefault_IsLazyConfigTrue()
        {
            //Assign
            var attr         = new StubChildrenAttribute();
            var config       = new ChildrenConfiguration();
            var propertyInfo = Substitute.For <PropertyInfo>();

            //Act
            attr.Configure(propertyInfo, config);

            //Assert
            Assert.AreEqual(propertyInfo, config.PropertyInfo);
            Assert.IsTrue(config.IsLazy);
            Assert.IsFalse(config.InferType);
        }
Example #4
0
        public void Configure_InferTypeSet_InferTypeSetOnConfig()
        {
            //Assign
            var attr         = new StubChildrenAttribute();
            var config       = new ChildrenConfiguration();
            var propertyInfo = typeof(StubItem).GetProperty("X");

            attr.InferType = true;

            //Act
            attr.Configure(propertyInfo, config);

            //Assert
            Assert.AreEqual(propertyInfo, config.PropertyInfo);
            Assert.IsTrue(config.InferType);
        }
        public void Configure_IsLazySetToFalse_IsLazyConfigFalse()
        {
            //Assign
            var attr         = new StubChildrenAttribute();
            var config       = new ChildrenConfiguration();
            var propertyInfo = typeof(StubItem).GetProperty("X");

            attr.IsLazy = false;

            //Act
            attr.Configure(propertyInfo, config);

            //Assert
            Assert.AreEqual(propertyInfo, config.PropertyInfo);
            Assert.IsFalse(config.IsLazy);
            Assert.IsFalse(config.InferType);
        }