public void Remove_ElementInCollection_ReturnsTrue() { // Setup var elementToBeRemoved = new TestItem("Item X"); var collection = new ConcreteObservableUniqueItemCollectionWithSourcePath <TestItem>( getUniqueFeature, typeDescriptor, featureDescription); var expectedCollections = new[] { new TestItem("Item A"), new TestItem("Item B"), new TestItem("Item C"), new TestItem("Item D") }; collection.AddRange(expectedCollections.Concat(new[] { elementToBeRemoved }), "path"); // Call bool removeSuccessful = collection.Remove(elementToBeRemoved); // Assert Assert.IsTrue(removeSuccessful); CollectionAssert.AreEqual(expectedCollections, collection); }
public void Remove_RemoveLastElement_ReturnsTrueAndClearSourcePath() { // Setup var elementToBeRemoved = new TestItem("Item X"); var collection = new ConcreteObservableUniqueItemCollectionWithSourcePath <TestItem>( getUniqueFeature, typeDescriptor, featureDescription); collection.AddRange(new[] { elementToBeRemoved }, "path"); // Precondition Assert.IsNotNull(collection.SourcePath); // Call bool removeSuccessful = collection.Remove(elementToBeRemoved); // Assert Assert.IsTrue(removeSuccessful); Assert.IsNull(collection.SourcePath); }