public void check_clone_copies_data()
        {
            var strValueTest = "Test String";
            var strKeyTest = "Mykey";
            var commentListTest = new List<string>(new string[] { "testComment 1", "testComment 2" });

            //Create a key data
            KeyData kd2 = new KeyData(strKeyTest);
            kd2.Value = strValueTest;
            kd2.Comments = commentListTest;

            KeyData kd = kd2.Clone() as KeyData;

            //Assert not null and empty
            Assert.That(kd, Is.Not.Null);
            Assert.That(kd.KeyName, Is.EqualTo(strKeyTest));
            Assert.That(kd.Value, Is.EqualTo(strValueTest));
            Assert.That(kd.Comments, Has.Count.EqualTo(2));
            Assert.That(kd.Comments[0], Is.EqualTo("testComment 1"));
            Assert.That(kd.Comments[1], Is.EqualTo("testComment 2"));

            kd.Value = "t";
            Assert.That(kd2.Value, Is.EqualTo(strValueTest));
            Assert.That(kd.Value, Is.EqualTo("t"));
        }
Exemple #2
0
        public void check_default_values()
        {
            var kd = new KeyData("key_name");

            Assert.That(kd, Is.Not.Null);
            Assert.That(kd.KeyName, Is.EqualTo("key_name"));
            Assert.That(kd.Comments, Is.Empty);
            Assert.That(kd.Value, Is.Empty);
        }
Exemple #3
0
        public void correct_comment_assigment_to_keydata()
        {
            IniData inidata = new IniData();
            inidata.Sections.AddSection("TestSection");

            KeyData key = new KeyData("TestKey");
            key.Value = "TestValue";
            key.Comments.Add("This is a comment");
            inidata["TestSection"].SetKeyData(key);

            Assert.That(inidata["TestSection"].GetKeyData("TestKey").Comments[0], Is.EqualTo("This is a comment"));
        }
        public void test()
        {
            var col = new KeyDataCollection();
            col.AddKey("key1");

            Assert.That(col["key1"], Is.Empty);


            col.AddKey("key2", "value2");

            Assert.That(col["key2"], Is.EqualTo("value2"));

            var keyData = new KeyData("key3");
            keyData.Value = "value3";
            col.AddKey(keyData);

            Assert.That(col["key3"], Is.EqualTo("value3"));
        }
Exemple #5
0
        public void creating_keydata_programatically()
        {
            var strValueTest = "Test String";
            var strKeyTest = "Mykey";
            var commentListTest = new List<string>(new string[] { "testComment 1", "testComment 2" });

            //Create a key data
            KeyData kd = new KeyData(strKeyTest);
            kd.Value = strValueTest;
            kd.Comments = commentListTest;

            //Assert not null and empty
            Assert.That(kd, Is.Not.Null);
            Assert.That(kd.KeyName, Is.EqualTo(strKeyTest));
            Assert.That(kd.Value, Is.EqualTo(strValueTest));
            Assert.That(kd.Comments, Has.Count.EqualTo(2));
            Assert.That(kd.Comments[0], Is.EqualTo("testComment 1"));
            Assert.That(kd.Comments[1], Is.EqualTo("testComment 2"));
        }
Exemple #6
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="KeyData"/> class
 ///     from a previous instance of <see cref="KeyData"/>.
 /// </summary>
 /// <remarks>
 ///     Data is deeply copied
 /// </remarks>
 /// <param name="ori">
 ///     The instance of the <see cref="KeyData"/> class
 ///     used to create the new instance.
 /// </param>
 public KeyData(KeyData ori)
 {
     _value    = ori._value;
     _keyName  = ori._keyName;
     _comments = new List <string>(ori._comments);
 }
Exemple #7
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="KeyData"/> class
 ///     from a previous instance of <see cref="KeyData"/>.
 /// </summary>
 /// <remarks>
 ///     Data is deeply copied
 /// </remarks>
 /// <param name="ori">
 ///     The instance of the <see cref="KeyData"/> class 
 ///     used to create the new instance.
 /// </param>
 public KeyData(KeyData ori)
 {
     _value = ori._value;
     _keyName = ori._keyName;
     _comments = new List<string>(ori._comments);
 }
Exemple #8
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="KeyData" class
 ///     from a previous instance of <see cref="KeyData".
 /// </summary>
 /// <remarks>
 ///     Data is deeply copied
 /// </remarks>
 /// <param name="ori">
 ///     The instance of the <see cref="KeyData" class
 ///     used to create the new instance.
 /// </param>
 public KeyData(KeyData ori)
 {
     Value    = ori.Value;
     keyName  = ori.keyName;
     comments = new List <string>(ori.comments);
 }