Esempio n. 1
0
        public void InjectPropertiesWithPropertySelectorAllowsPrivateSet()
        {
            const string str = "test";

            var cb = new ContainerBuilder();

            cb.RegisterInstance(str);
            var c = cb.Build();

            var obj = new HasMixedVisibilityProperties();

            Assert.Null(obj.PublicString);
            Assert.Null(obj.PrivateStringAccessor());
            c.InjectProperties(obj, new InjectAttributePropertySelector());
            Assert.Null(obj.PublicString);
            Assert.Equal(str, obj.PrivateStringAccessor());
        }
Esempio n. 2
0
        public void InjectUnsetPropertiesUsesPublicOnly()
        {
            const string str = "test";

            var cb = new ContainerBuilder();

            cb.RegisterInstance(str);
            var c = cb.Build();

            var obj = new HasMixedVisibilityProperties();

            Assert.Null(obj.PublicString);
            Assert.Null(obj.PrivateStringAccessor());
            c.InjectUnsetProperties(obj);
            Assert.Equal(str, obj.PublicString);
            Assert.Null(obj.PrivateStringAccessor());
        }