예제 #1
0
        public void ConstructorWithNullValue()
        {
            SPSKeyValuePair keyValue = new SPSKeyValuePair("Key", null);

            Assert.IsTrue(keyValue.Key == "Key");
            Assert.IsTrue(keyValue.Value == null);
        }
예제 #2
0
        public void Constructor()
        {
            SPSKeyValuePair keyValue = new SPSKeyValuePair("Key", "Value");

            Assert.IsTrue(keyValue.Key == "Key");
            Assert.IsTrue(keyValue.Value == "Value");
        }
예제 #3
0
        public void Use()
        {
            SPSKeyValuePair keyValue = new SPSKeyValuePair("Key", null);

            keyValue.Key   = "KeyA";
            keyValue.Value = "Value";

            Assert.IsTrue(keyValue.Key == "KeyA");
            Assert.IsTrue(keyValue.Value == "Value");
        }
예제 #4
0
        public void SerializeDeserialize()
        {
            SPSKeyValueList keyValuesBefore = new SPSKeyValueList();

            SPSKeyValuePair keyValue0 = new SPSKeyValuePair("KeyA", "Value1");
            SPSKeyValuePair keyValue1 = new SPSKeyValuePair("KeyB", "Value2");

            keyValuesBefore.Add(keyValue0);
            keyValuesBefore.Add(keyValue1);

            string serialized = SPSKeyValueList.Serialize(keyValuesBefore);

            SPSKeyValueList keyValuesAfter = SPSKeyValueList.Deserialize(serialized);

            Assert.IsTrue(keyValuesAfter.Count == keyValuesBefore.Count);

            Assert.IsTrue(keyValuesAfter.Count == keyValuesBefore.Count);

            Assert.IsTrue(keyValuesAfter.Contains("KeyA"));
            Assert.IsTrue(keyValuesAfter.Contains("KeyB"));

            Assert.IsTrue(keyValuesAfter[0].Value == "Value1");
            Assert.IsTrue(keyValuesAfter[1].Value == "Value2");
        }
예제 #5
0
 public void ConstructorWithNullKey()
 {
     SPSKeyValuePair pair = new SPSKeyValuePair(null, "Value");
 }
 /// <summary>
 /// Adds the variable.
 /// </summary>
 /// <param name="keyValuePair">The key value pair.</param>
 public void AddVariable(SPSKeyValuePair keyValuePair)
 {
     _variableValues.Add(keyValuePair);
 }