public void TestDoublePostConstruct()
        {
            PostConstructSimple instance = new PostConstructSimple ();
            binder.Bind<PostConstructSimple> ().ToValue (instance);
            binder.Bind<InjectsPostConstructSimple> ().To<InjectsPostConstructSimple>();

            InjectsPostConstructSimple instance1 = binder.GetInstance<InjectsPostConstructSimple> () as InjectsPostConstructSimple;
            InjectsPostConstructSimple instance2 = binder.GetInstance<InjectsPostConstructSimple> () as InjectsPostConstructSimple;

            Assert.AreSame (instance, instance1.pcs);
            Assert.AreNotSame (instance1, instance2);
            Assert.AreEqual (1, PostConstructSimple.PostConstructCount);
        }
Esempio n. 2
0
        public void TestDoublePostConstruct()
        {
            PostConstructSimple instance = new PostConstructSimple();

            binder.Bind <PostConstructSimple> ().ToValue(instance);
            binder.Bind <InjectsPostConstructSimple> ().To <InjectsPostConstructSimple>();

            InjectsPostConstructSimple instance1 = binder.GetInstance <InjectsPostConstructSimple> () as InjectsPostConstructSimple;
            InjectsPostConstructSimple instance2 = binder.GetInstance <InjectsPostConstructSimple> () as InjectsPostConstructSimple;

            Assert.AreSame(instance, instance1.pcs);
            Assert.AreNotSame(instance1, instance2);
            Assert.AreEqual(1, PostConstructSimple.PostConstructCount);
        }