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]); }
public void Insert_IfTheIndexIsOutOfRange_ShouldThrowAConfigurationErrorsException() { ConfigurationElementCollectionMock configurationElementCollection = new ConfigurationElementCollectionMock(); configurationElementCollection.Insert(10, new ConfigurationElementMock()); }