public void ConfigurationIsRespected() { var settings = new SettingsBuilder() .UseSettingsDictionary(_settingsDictionary) .Build(); //No Configuration, should return unqualified setting Assert.AreEqual("Key", settings.Get <string>("Key")); settings.SetConfiguration("prod"); Assert.AreEqual("PROD", settings.Get <string>("Key")); settings.SetConfiguration("test"); Assert.AreEqual("TEST", settings.Get <string>("Key")); }
public void ConfigurationChangeFiresPropertyChangeEvents() { var settings = new SettingsBuilder() .UseSettingsDictionary(_settingsDictionary) .Build <MySettings>(); var propertyChangeNotifications = new List <string>(); settings.PropertyChanged += (sender, args) => propertyChangeNotifications.Add(args.PropertyName); Assert.AreEqual("Key", settings.Key); settings.SetConfiguration("prod"); Assert.AreEqual("Key", propertyChangeNotifications.Single()); //changing config but no properties will change settings.SetConfiguration("prod2"); //no changes so we shouldn't have received additional events Assert.AreEqual("Key", propertyChangeNotifications.Single()); }