public void TestIfSavingAndLoadingWorks() { var tempFile = Path.GetTempFileName(); var settings = new BuildMonitorSettings(Guid.NewGuid().ToString()); settings.Add("Test1", "02fdb4e0-fa5d-472a-918a-fc02c48b11a8"); settings.Add("Test2", new List <String> { "Item1", "Item2" }); //settings.Add("Test3", new List<IBuildDefinition> { GetTestBuildDefinition(1), GetTestBuildDefinition(2) }); var container = new SettingsContainer <BuildMonitorSettings>(); container.Add(settings); container.Save(tempFile); var loadedContainer = SettingsContainer <BuildMonitorSettings> .Load(tempFile); Assert.IsNotNull(loadedContainer); Assert.AreEqual(container.Count, loadedContainer.Count); var loadedSettings = loadedContainer.Single(); Assert.IsNotNull(loadedSettings); Assert.AreEqual(settings.BuildProviderId, loadedSettings.BuildProviderId); Assert.AreEqual(settings.UniqueId, loadedSettings.UniqueId); Assert.AreEqual(settings.Count, loadedSettings.Count); foreach (var keyValuePair in settings) { var loadedValue = loadedSettings[keyValuePair.Key]; Assert.IsNotNull(loadedValue); var expected = keyValuePair.Value as ICollection; if (expected != null) { CollectionAssert.AreEqual(expected, loadedValue as ICollection); } else { Assert.AreEqual(keyValuePair.Value, loadedValue); } } }