public void TestRepeatExtend() { var cls = new TestManagerClass(); cls.Extend(() => null, "test"); ExceptionAssert.Throws <RuntimeException>(() => { cls.Extend(() => null, "test"); }); }
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); }
public void TestGetExtend() { var cls = new TestManagerClass(); ExceptionAssert.Throws <RuntimeException>(() => { cls.GetResolvePublic(null); }); cls.Extend(() => { return(new TestManagerClass()); }); }
public void TestExtend() { var cls = new TestManagerClass(); TestManagerClass tmp = null; cls.Extend(() => { return(tmp = new TestManagerClass()); }); var result = cls[null]; Assert.AreSame(tmp, result); }
public void TestReleaseExtendAndMake() { var cls = new TestManagerClass(); TestManagerClass tmp = null; cls.Extend(() => { return(tmp = new TestManagerClass()); }); cls.RemoveExtend(); ExceptionAssert.Throws <RuntimeException>(() => { cls.Get(); }); }