public void RemoveAt_ShouldRemoveTheItemAtTheGivenIndex() { 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(3, configurationElementCollection.Count); configurationElementCollection.RemoveAt(1); Assert.AreEqual(2, configurationElementCollection.Count); Assert.AreEqual(firstConfigurationElement, configurationElementCollection[0]); Assert.AreEqual(thirdConfigurationElement, configurationElementCollection[1]); configurationElementCollection.RemoveAt(0); Assert.AreEqual(1, configurationElementCollection.Count); Assert.AreEqual(thirdConfigurationElement, configurationElementCollection[0]); configurationElementCollection.RemoveAt(0); Assert.AreEqual(0, configurationElementCollection.Count); }
public void RemoveAt_IfTheIndexIsOutOfRange_ShouldThrowAConfigurationErrorsException() { ConfigurationElementCollectionMock configurationElementCollection = new ConfigurationElementCollectionMock(); configurationElementCollection.RemoveAt(0); }