Add() public method

Adds a specified boolean to the settings list.
is null.
public Add ( string settingName, bool value ) : void
settingName string The name of the setting.
value bool The value of the setting.
return void
        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"));
        }
        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"));
        }
        public void AddForByteArray_WithValidValue_UpdatesDictionary()
        {
            var helper = new RuleSettingsHelper();

            helper.Add("good", new byte[] { 1, 2, 3 });
            Assert.AreEqual(1, helper.Count);
        }
        public void AddForBoolean_WithValidValue_UpdatesDictionary()
        {
            var helper = new RuleSettingsHelper();

            helper.Add("good", true);
            Assert.AreEqual(1, helper.Count);
        }
 public void AddForInteger_WithNullSettingName_ThrowsException()
 {
     var helper = new RuleSettingsHelper();
     Assert.That(
         () => helper.Add(null, 15),
         Throws.Exception.TypeOf<ArgumentNullException>().With.Property("ParamName").EqualTo("settingName"));
 }
 public void AddForByteArray_WithNullValue_ThrowsException()
 {
     var helper = new RuleSettingsHelper();
     byte[] bytes = null;
     Assert.That(
         () => helper.Add("good", bytes),
         Throws.Exception.TypeOf<ArgumentNullException>().With.Property("ParamName").EqualTo("value"));
 }
        public void AddForInteger_WithNullSettingName_ThrowsException()
        {
            var helper = new RuleSettingsHelper();

            Assert.That(
                () => helper.Add(null, 15),
                Throws.Exception.TypeOf <ArgumentNullException>().With.Property("ParamName").EqualTo("settingName"));
        }
        public void AddForString_WithNullValue_ThrowsException()
        {
            var    helper = new RuleSettingsHelper();
            string s      = null;

            Assert.That(
                () => helper.Add("good", s),
                Throws.Exception.TypeOf <ArgumentNullException>().With.Property("ParamName").EqualTo("value"));
        }
        public void AddForByteArray_WithEmptyValue_ThrowsException()
        {
            var helper = new RuleSettingsHelper();

            byte[] bytes = new byte[0];
            Assert.That(
                () => helper.Add("good", bytes),
                Throws.Exception.TypeOf <ArgumentOutOfRangeException>().With.Property("ParamName").EqualTo("value"));
        }
        public void FindInteger_WithValidSetting_ReturnsValue()
        {
            var helper       = new RuleSettingsHelper();
            var expected     = 15;
            var defaultValue = 20;

            helper.Add("good", expected);
            Assert.AreEqual(expected, helper.FindInteger("good", defaultValue));
        }
        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));
        }
        public void FindBooelan_WithValidSetting_ReturnsValue()
        {
            var helper       = new RuleSettingsHelper();
            var expected     = true;
            var defaultValue = false;

            helper.Add("good", expected);
            Assert.AreEqual(expected, helper.FindBoolean("good", defaultValue));
        }
        public void FindByteArray_WithValidSetting_ReturnsValue()
        {
            var helper       = new RuleSettingsHelper();
            var expected     = new byte[] { 1, 2, 3 };
            var defaultValue = new byte[] { 4, 5, 6 };

            helper.Add("good", expected);
            CollectionAssert.AreEqual(expected, helper.FindByteArray("good", defaultValue));
        }
示例#14
0
 public void FindBooelan_WithValidSetting_ReturnsValue()
 {
     var helper = new RuleSettingsHelper();
     var expected = true;
     var defaultValue = false;
     helper.Add("good", expected);
     Assert.AreEqual(expected, helper.FindBoolean("good", defaultValue));
 }
示例#15
0
 public void FindInteger_WithValidSetting_ReturnsValue()
 {
     var helper = new RuleSettingsHelper();
     var expected = 15;
     var defaultValue = 20;
     helper.Add("good", expected);
     Assert.AreEqual(expected, helper.FindInteger("good", defaultValue));
 }
示例#16
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));
 }
示例#17
0
 public void AddForByteArray_WithValidValue_UpdatesDictionary()
 {
     var helper = new RuleSettingsHelper();
     helper.Add("good", new byte[] { 1, 2, 3 });
     Assert.AreEqual(1, helper.Count);
 }
示例#18
0
 public void FindByteArray_WithValidSetting_ReturnsValue()
 {
     var helper = new RuleSettingsHelper();
     var expected = new byte[] { 1, 2, 3 };
     var defaultValue = new byte[] { 4, 5, 6 };
     helper.Add("good", expected);
     CollectionAssert.AreEqual(expected, helper.FindByteArray("good", defaultValue));
 }
示例#19
0
 public void AddForStringr_WithValidValue_UpdatesDictionary()
 {
     var helper = new RuleSettingsHelper();
     helper.Add("good", "good");
     Assert.AreEqual(1, helper.Count);
 }