public void Add_ShouldAddTheItemToTheCollection() { ConfigurationElementCollectionMock configurationElementCollection = new ConfigurationElementCollectionMock(); Assert.IsTrue(configurationElementCollection.Count == 0); configurationElementCollection.Add(new ConfigurationElementMock()); Assert.IsTrue(configurationElementCollection.Count == 1); }
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); }