public void RemoveNonExistingSingleton() { using (var singleton = new MyDisposable()) { SingletonsContainer.Add("foo", singleton); Assert.IsFalse(SingletonsContainer.Remove("bar")); Assert.AreSame(singleton, SingletonsContainer.Item("foo")); } }
public void RemoveSingleton() { using (var singleton = new MyDisposable()) { SingletonsContainer.Add("foo", singleton); Assert.IsTrue(SingletonsContainer.Remove("foo")); Assert.IsFalse(singleton.DisposeCalled); Assert.IsNull(SingletonsContainer.Item("foo")); } }