public void InjectPropertiesWithSelector()
        {
            const string str = "test";

            var cb = new ContainerBuilder();

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

            var obj = new WithPropInjection();

            Assert.Null(obj.Prop);
            c.InjectProperties(obj, new DelegatePropertySelector((p, _) => p.GetCustomAttributes <InjectAttribute>().Any()));
            Assert.Null(obj.Prop);
            Assert.Equal(str, obj.GetProp2());
        }
        public void InjectProperties()
        {
            const string str = "test";

            var cb = new ContainerBuilder();

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

            var obj = new WithPropInjection();

            Assert.Null(obj.Prop);
            c.InjectUnsetProperties(obj);
            Assert.Equal(str, obj.Prop);
            Assert.Null(obj.GetProp2());
        }
        public void InjectPropertiesWithSelector()
        {
            const string str = "test";

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

            var obj = new WithPropInjection();

            Assert.Null(obj.Prop);
            c.InjectProperties(obj, new DelegatePropertySelector((p, _) => p.GetCustomAttributes<InjectAttribute>().Any()));
            Assert.Null(obj.Prop);
            Assert.Equal(str, obj.GetProp2());
        }
        public void InjectUnsetProperties()
        {
            const string str = "test";
            const string otherStr = "someString";

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

            var obj = new WithPropInjection
            {
                Prop = otherStr
            };

            Assert.Equal(otherStr, obj.Prop);
            c.InjectUnsetProperties(obj);
            Assert.Equal(otherStr, obj.Prop);
            Assert.Null(obj.GetProp2());
        }