Beispiel #1
0
        public void Contains()
        {
            SPSKeyValueList keyValues = new SPSKeyValueList();

            keyValues.Add(new SPSKeyValuePair("Key", "Value"));
            keyValues.Add(new SPSKeyValuePair("Key", "Value"));

            Assert.IsTrue(keyValues.Contains("Key"));
            Assert.IsFalse(keyValues.Contains("OtherKey"));
        }
Beispiel #2
0
 /// <summary>
 /// Lasts the row.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <returns>The value for the last row key (Row[Column])</returns>
 public string LastRow(string key)
 {
     if (_keyValues.Contains(key))
     {
         return(_keyValues[key]);
     }
     return(string.Empty);
 }
Beispiel #3
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");
        }