Example #1
0
        public void TestRepeatExtend()
        {
            var cls = new TestManagerClass();

            cls.Extend(() => null, "test");
            ExceptionAssert.Throws <RuntimeException>(() =>
            {
                cls.Extend(() => null, "test");
            });
        }
Example #2
0
        public void TestOnAfterExtend()
        {
            var cls = new TestManagerClass();

            TestManagerClass tmp = null;

            cls.Extend(() =>
            {
                return(tmp = new TestManagerClass());
            });

            var isResolving      = false;
            var isAfterResolving = false;

            cls.OnAfterResolving += (instance) =>
            {
                Assert.AreEqual(true, isResolving);
                isAfterResolving = true;
            };
            cls.OnResolving += (instance) =>
            {
                isResolving = true;
            };

            var result = cls[null];

            Assert.AreEqual(true, isAfterResolving);
            Assert.AreSame(tmp, result);
        }
Example #3
0
        public void TestGetExtend()
        {
            var cls = new TestManagerClass();

            ExceptionAssert.Throws <RuntimeException>(() =>
            {
                cls.GetResolvePublic(null);
            });

            cls.Extend(() =>
            {
                return(new TestManagerClass());
            });
        }
Example #4
0
        public void TestExtend()
        {
            var cls = new TestManagerClass();

            TestManagerClass tmp = null;

            cls.Extend(() =>
            {
                return(tmp = new TestManagerClass());
            });

            var result = cls[null];

            Assert.AreSame(tmp, result);
        }
Example #5
0
        public void TestReleaseExtendAndMake()
        {
            var cls = new TestManagerClass();

            TestManagerClass tmp = null;

            cls.Extend(() =>
            {
                return(tmp = new TestManagerClass());
            });

            cls.RemoveExtend();

            ExceptionAssert.Throws <RuntimeException>(() =>
            {
                cls.Get();
            });
        }