public void RemovingItemRemovesTypeIdPairFromLocator() { TestableManagedObjectCollection <object> collection = CreateManagedObjectCollection(); object obj = collection.AddNew <object>("Foo"); collection.Remove(obj); Assert.IsNull(collection.Locator.Get(new DependencyResolutionLocatorKey(typeof(object), "Foo"))); }
public void RemoveRemovesFromLocator() { TestableManagedObjectCollection <object> collection = CreateManagedObjectCollection(); object obj = new object(); collection.Add(obj, "Foo"); collection.Remove(obj); Assert.IsFalse(collection.Locator.Contains("Foo")); }
public void RemoveRemovesFromLifetimeContainer() { TestableManagedObjectCollection <object> collection = CreateManagedObjectCollection(); object obj = new object(); collection.Add(obj); collection.Remove(obj); Assert.IsFalse(collection.LifetimeContainer.Contains(obj)); }
public void RemovingNamedObjectCausesNameToBeAvailableAgain() { TestableManagedObjectCollection <object> collection = CreateManagedObjectCollection(); object obj = collection.AddNew <object>("Foo"); collection.Remove(obj); object obj2 = collection.AddNew <object>("Foo"); Assert.IsNotNull(obj2); Assert.IsTrue(obj != obj2); }
public void RemovingObjectCausesItToBeTornDown() { TestableManagedObjectCollection <object> collection = CreateManagedObjectCollection(); MockTearDownStrategy strategy = new MockTearDownStrategy(); collection.Builder.Strategies.Add(strategy, BuilderStage.PreCreation); object obj = collection.AddNew <object>(); collection.Remove(obj); Assert.IsTrue(strategy.TearDownCalled); }
public void RemovingObjectNotInCollectionNoThrow() { TestableManagedObjectCollection <object> collection = CreateManagedObjectCollection(); collection.Remove(new object()); }
public void RemovingNullDoesntThrow() { TestableManagedObjectCollection <object> collection = CreateManagedObjectCollection(); collection.Remove(null); }