Beispiel #1
0
        public void MakeArrayFromValues_GoodValues_MakesArray()
        {
            var list = new List <string>();

            list.Add(JSONUtils.MakeKeyValuePair("corvette", "car"));
            list.Add(JSONUtils.MakeKeyValuePair("banana", "fruit"));
            list.Add(JSONUtils.MakeKeyValuePair("spot", "dog"));

            Assert.AreEqual("\"stuff\":{\"0\":{\"corvette\":\"car\"},\"1\":{\"banana\":\"fruit\"},\"2\":{\"spot\":\"dog\"}}",
                            JSONUtils.MakeArrayFromValues("stuff", list));
        }
Beispiel #2
0
 public void MakeKeyValuePair_BracketValue_ReturnsBracketedValue()
 {
     Assert.AreEqual("\"key\":[\"value\"]", JSONUtils.MakeKeyValuePair("key", "value", true));
 }
Beispiel #3
0
 public void MakeKeyValuePair_KeyAndValueAreGood_ReturnsCorrectString()
 {
     Assert.AreEqual("\"key\":\"value\"", JSONUtils.MakeKeyValuePair("key", "value"));
 }
Beispiel #4
0
 public void MakeKeyValuePair_ValueIsNull_ReturnsNull()
 {
     Assert.IsNull(JSONUtils.MakeKeyValuePair("blah", null));
 }
Beispiel #5
0
 public void MakeKeyValuePair_KeyIsNull_ReturnsNull()
 {
     Assert.IsNull(JSONUtils.MakeKeyValuePair(null, "blah"));
 }
Beispiel #6
0
 public void MakeKeyValuePair_BothAreEmtpy_ReturnsNull()
 {
     Assert.IsNull(JSONUtils.MakeKeyValuePair("", ""));
 }