FindString() public method

Finds the T:System.String value for the specified setting.
public FindString ( string settingName, string defaultValue ) : string
settingName string The name of the setting.
defaultValue string The default value of the setting if it is not found.
return string
コード例 #1
0
        public void FindString_WithInvalidSetting_ReturnsDefault()
        {
            var helper   = new RuleSettingsHelper();
            var expected = "goodbye";

            Assert.AreEqual(expected, helper.FindString("good", expected));
        }
コード例 #2
0
        public void FindString_WithValidSetting_ReturnsValue()
        {
            var helper       = new RuleSettingsHelper();
            var expected     = "hello";
            var defaultValue = "goodbye";

            helper.Add("good", expected);
            Assert.AreEqual(expected, helper.FindString("good", defaultValue));
        }
コード例 #3
0
        public void AddForExistingSetting_UpdatesSetting_UpdatesDictionary()
        {
            var expected = "override";
            var helper   = new RuleSettingsHelper();

            helper.Add("good", true);
            helper.Add("good", expected);
            Assert.AreEqual(1, helper.Count);
            Assert.AreEqual(expected, helper.FindString("good", "good"));
        }
コード例 #4
0
        public void AddForExistingSetting_UpdatesSetting_UpdatesDictionary()
        {
            var expected = "override";
            var helper = new RuleSettingsHelper();

            helper.Add("good", true);
            helper.Add("good", expected);
            Assert.AreEqual(1, helper.Count);
            Assert.AreEqual(expected, helper.FindString("good", "good"));
        }
コード例 #5
0
 public void FindString_WithValidSetting_ReturnsValue()
 {
     var helper = new RuleSettingsHelper();
     var expected = "hello";
     var defaultValue = "goodbye";
     helper.Add("good", expected);
     Assert.AreEqual(expected, helper.FindString("good", defaultValue));
 }
コード例 #6
0
 public void FindString_WithInvalidSetting_ReturnsDefault()
 {
     var helper = new RuleSettingsHelper();
     var expected = "goodbye";
     Assert.AreEqual(expected, helper.FindString("good", expected));
 }