コード例 #1
0
        public void TypeBasedOverrideWithBuildUp()
        {
            MySimpleType instance = new MySimpleType();
            instance.X = 111;

            PropertyOverride overrideParam = new PropertyOverride("X", 222);
            TypeBasedOverride overrideDecorator = new TypeBasedOverride(typeof(MySimpleType), overrideParam);

            UnityContainer container = new UnityContainer();

            var result = container.BuildUp<MySimpleType>(instance, overrideDecorator);
            Assert.AreEqual<int>(222, result.X);
        }
コード例 #2
0
        public void TypeBasedOverrideWithBuildUp()
        {
            MySimpleType instance = new MySimpleType();

            instance.X = 111;

            PropertyOverride  overrideParam     = new PropertyOverride("X", 222);
            TypeBasedOverride overrideDecorator = new TypeBasedOverride(typeof(MySimpleType), overrideParam);

            UnityContainer container = new UnityContainer();

            var result = container.BuildUp <MySimpleType>(instance, overrideDecorator);

            Assert.AreEqual <int>(222, result.X);
        }