public void Reset_Reverts_All_Items_To_Defaults() { //Arrange var mgr = new SimpleSettingsMgr(); mgr.Location = new PointF(33f, 44f); mgr.Comments = "blah"; mgr.Reset(); PointF result = mgr.Location; object[] defaults = (mgr as ElementSettingsMgr).Defaults; for (int i = 0; i < mgr.Names.Length; i++) { object val = mgr[mgr.Names[i]]; object dft = defaults[i]; Assert.Equal(dft, val); } }
public void Reset_For_Location_Reverts_Its_Default(float x, float y, string name) { //Arrange var mgr = new SimpleSettingsMgr(); PointF expectedLoc = new PointF(x, y); mgr.Location = expectedLoc; mgr.Reset(name); PointF result = mgr.Location; Assert.Equal(ElementSettingsMgr._LocationDefault, result); }
public void Reset_For_Location_Does_Not_Fire_SettingsChangedEvent_If_Values_Have_Changed(float x, float y, string name) { //Arrange var mgr = new SimpleSettingsMgr(); var helper = new HelperForSettingsMgr(); mgr.SettingsChanged += new SettingsChangedEventHandler<ISettings, SettingsChangedEventArgs> (helper.SettingsChanged_DummyHandler); PointF expectedLoc = new PointF(x, y); mgr.Location = expectedLoc; //Act mgr.Reset(name); //Assert Assert.Equal(0, helper.SettingsChanged_TimesCalled); }
public void Reset_For_Comments_Reverts_Its_Default(string comment, string name) { //Arrange var mgr = new SimpleSettingsMgr(); mgr.Comments = comment; mgr.Reset(name); string result = mgr.Comments; Assert.Equal(ElementSettingsMgr._CommentsDefault, result); }
public void Reset_For_Comments_Does_Not_Fire_SettingsChangedEvent_If_Values_Have_Changed(string comment, string name) { //Arrange var mgr = new SimpleSettingsMgr(); var helper = new HelperForSettingsMgr(); mgr.SettingsChanged += new SettingsChangedEventHandler<ISettings, SettingsChangedEventArgs> (helper.SettingsChanged_DummyHandler); mgr.Comments = comment; //Act mgr.Reset(name); //Assert Assert.Equal(0, helper.SettingsChanged_TimesCalled); }
public void Reset_Does_Not_Fires_SettingsChangedEvent_After_All_Changes_Are_Made() { //Arrange var mgr = new SimpleSettingsMgr(); mgr.Location = new PointF(33f, 44f); mgr.Comments = "blah"; var helper = new HelperForSettingsMgr(); mgr.SettingsChanged += new SettingsChangedEventHandler<ISettings, SettingsChangedEventArgs> (helper.SettingsChanged_DummyHandler); //Act mgr.Reset(); //Assert Assert.Equal(0, helper.SettingsChanged_TimesCalled); }