public void Remove_IfTheItemExists_ShouldRemoveTheItemFromTheCollectionAndReturnTrue() { ConfigurationElementMock firstConfigurationElement = new ConfigurationElementMock {Name = "1"}; ConfigurationElementCollectionMock configurationElementCollection = new ConfigurationElementCollectionMock {firstConfigurationElement}; Assert.IsTrue(configurationElementCollection.Remove(firstConfigurationElement)); Assert.AreEqual(0, configurationElementCollection.Count); configurationElementCollection.Add(firstConfigurationElement); Assert.AreEqual(1, configurationElementCollection.Count); ConfigurationElementMock secondConfigurationElement = new ConfigurationElementMock {Name = "1"}; Assert.IsTrue(configurationElementCollection.Remove(secondConfigurationElement)); Assert.AreEqual(0, configurationElementCollection.Count); }
public void Remove_IfTheItemDoesNotExist_ShouldReturnFalse() { ConfigurationElementMock firstConfigurationElement = new ConfigurationElementMock {Name = "1"}; ConfigurationElementCollectionMock configurationElementCollection = new ConfigurationElementCollectionMock {firstConfigurationElement}; ConfigurationElementMock secondConfigurationElement = new ConfigurationElementMock {Name = "2"}; Assert.AreEqual(1, configurationElementCollection.Count); Assert.IsFalse(configurationElementCollection.Remove(secondConfigurationElement)); Assert.AreEqual(1, configurationElementCollection.Count); }