Esempio n. 1
0
        public void CheckIllegalRelease()
        {
            var container = new CatLib.Stl.Container();
            var bindData  = new CatLib.Stl.BindData(container, "CheckIllegalRelease", (app, param) => "hello world", false);

            ExceptionAssert.Throws <ArgumentNullException>(() =>
            {
                bindData.OnRelease(null);
            });

            ExceptionAssert.Throws <RuntimeException>(() =>
            {
                bindData.OnRelease((bind, obj) =>
                {
                    Assert.Fail();
                });
                container.Instance("CheckIllegalRelease", "Test");
                container.Release("CheckIllegalRelease");
            });
        }
Esempio n. 2
0
        public void CanOnRelease()
        {
            var container = new CatLib.Stl.Container();
            var bindData  = new CatLib.Stl.BindData(container, "CanAddOnRelease", (app, param) => "hello world", true);

            bindData.OnRelease((bind, obj) =>
            {
                Assert.AreEqual("Test", obj);
                Assert.AreSame(bindData, bind);
            });

            container.Instance("CanAddOnRelease", "Test");
            container.Release("CanAddOnRelease");
        }