public void TestContains() { var manager = new TestManager(); manager.Extend(() => new InterfaceImpl()); bool resolve = false, release = false; manager.OnResolving += (_) => { resolve = true; }; manager.OnRelease += (_) => { release = true; }; Assert.AreEqual(false, manager.Contains()); Assert.AreEqual(false, resolve); Assert.AreEqual(false, release); manager.Get(); Assert.AreEqual(true, resolve); Assert.AreEqual(true, manager.Contains()); manager.Release(); Assert.AreEqual(true, release); Assert.AreEqual(false, manager.Contains()); }
public void TestDispose() { var manager = new TestManager(); manager.Extend(() => new InterfaceImpl()); manager.Extend(() => new InterfaceImpl(), "name-2"); manager.Get(); manager.Get("name-2"); Assert.AreEqual(true, manager.Contains()); Assert.AreEqual(true, manager.Contains("name-2")); manager.Dispose(); Assert.AreEqual(false, manager.Contains()); Assert.AreEqual(false, manager.Contains("name-2")); }