예제 #1
0
        public void TestEncodeEmpty()
        {
            var obj = new Dictionary <string, string>();

            var encoded = KvpParser.Encode(obj);

            Assert.AreEqual(string.Empty, encoded);
        }
        public static string ProfileFor(string email)
        {
            var profile = new Dictionary <string, string>
            {
                { "email", email },
                { "uid", "10" },
                { "role", "user" }
            };

            return(KvpParser.Encode(profile));
        }
예제 #3
0
        public void TestEncodeSingle()
        {
            var obj = new Dictionary <string, string>
            {
                { "key", "value" }
            };

            var encoded = KvpParser.Encode(obj);

            Assert.AreEqual("key=value", encoded);
        }
예제 #4
0
        public void TestEncodeRemoveInvalidChars()
        {
            var obj = new Dictionary <string, string>
            {
                { "key1=", "=val1" },
                { "key2&", "val2&" }
            };

            var encoded = KvpParser.Encode(obj);

            Assert.AreEqual("key1=val1&key2=val2", encoded);
        }
예제 #5
0
        public void TestEncodeMultiple()
        {
            var obj = new Dictionary <string, string>
            {
                { "key1", "val1" },
                { "key2", "val2" },
                { "key3", "val3" }
            };

            var encoded = KvpParser.Encode(obj);

            Assert.AreEqual("key1=val1&key2=val2&key3=val3", encoded);
        }
예제 #6
0
 public void TestEncodeNull()
 {
     KvpParser.Encode(null);
 }