public void TryToSaveWithAFileConfigurationSaveParameter()
        {
            SystemConfigurationSource source = new SystemConfigurationSource();
            source.Add(new FileConfigurationParameter(file), InstrumentationConfigurationSection.SectionName, CreateInstrumentationSection());

            ValidateConfiguration(file);
        }
		public void RemovingAndAddingSection()
		{
			SystemConfigurationSource.ResetImplementation(true);
			SystemConfigurationSource sysSource = new SystemConfigurationSource();

			DummySection dummySection = sysSource.GetSection(localSection) as DummySection;
			Assert.IsTrue(dummySection != null);

			System.Threading.Thread.Sleep(300);

			System.Configuration.Configuration rwConfiguration =
				ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
			string fileName = rwConfiguration.FilePath;
			int numSections = rwConfiguration.Sections.Count;
			FileConfigurationParameter parameter = new FileConfigurationParameter(fileName);
			sysSource.Remove(parameter, localSection);

			System.Threading.Thread.Sleep(300);

			rwConfiguration =
				ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
			Assert.AreEqual(rwConfiguration.Sections.Count, numSections - 1);
			sysSource.Add(parameter, localSection, new DummySection());	// can't be the same instance

			System.Threading.Thread.Sleep(300);
			rwConfiguration =
				ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
			Assert.AreEqual(rwConfiguration.Sections.Count, numSections);
		}
 public void TryToSaveWithTheWrongConfigurationSaveParameterTypeThrows()
 {
     SystemConfigurationSource source = new SystemConfigurationSource();
     source.Add(new WrongConfigurationSaveParameter(), InstrumentationConfigurationSection.SectionName, CreateInstrumentationSection());
 }