public void Clear_ShouldClearTheCollection() { ConfigurationElementCollectionMock configurationElementCollection = new ConfigurationElementCollectionMock { new ConfigurationElementMock {Name = "1"}, new ConfigurationElementMock {Name = "2"}, new ConfigurationElementMock {Name = "3"} }; Assert.AreEqual(3, configurationElementCollection.Count); configurationElementCollection.Clear(); Assert.AreEqual(0, configurationElementCollection.Count); }
public void Insert_ShouldInsertTheItemAtTheGivenIndex() { ConfigurationElementMock firstConfigurationElement = new ConfigurationElementMock {Name = "1"}; ConfigurationElementMock secondConfigurationElement = new ConfigurationElementMock {Name = "2"}; ConfigurationElementMock thirdConfigurationElement = new ConfigurationElementMock {Name = "3"}; ConfigurationElementCollectionMock configurationElementCollection = new ConfigurationElementCollectionMock { firstConfigurationElement, secondConfigurationElement, thirdConfigurationElement }; Assert.AreEqual(firstConfigurationElement, configurationElementCollection[0]); Assert.AreEqual(secondConfigurationElement, configurationElementCollection[1]); Assert.AreEqual(thirdConfigurationElement, configurationElementCollection[2]); configurationElementCollection.Clear(); configurationElementCollection.Insert(0, firstConfigurationElement); configurationElementCollection.Insert(0, secondConfigurationElement); configurationElementCollection.Insert(0, thirdConfigurationElement); Assert.AreEqual(thirdConfigurationElement, configurationElementCollection[0]); Assert.AreEqual(secondConfigurationElement, configurationElementCollection[1]); Assert.AreEqual(firstConfigurationElement, configurationElementCollection[2]); }