Example #1
0
 public void RemoveNonExistingSingleton()
 {
     using (var singleton = new MyDisposable())
     {
         SingletonsContainer.Add("foo", singleton);
         Assert.IsFalse(SingletonsContainer.Remove("bar"));
         Assert.AreSame(singleton, SingletonsContainer.Item("foo"));
     }
 }
Example #2
0
 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"));
     }
 }