예제 #1
0
        public void HttpContentHelper_FormUrlEncoded_Sets_The_ContentType_Header()
        {
            var content = HttpContentHelper.FormUrlEncoded(new [, ] {
                { "key1", "value1" }
            });

            Assert.AreEqual("application/x-www-form-urlencoded", content.Headers.ContentType.ToString());
        }
예제 #2
0
        public void HttpContentHelper_FormUrlEncoded_Encodes_Values()
        {
            var content = HttpContentHelper.FormUrlEncoded(new [, ] {
                { "key", "&" }
            });
            var text = content.ReadAsStringAsync().Result;

            Assert.AreEqual("key=%26", text);
        }
예제 #3
0
        public void HttpContentHelper_FormUrlEncoded_Handles_Empty_Value_Correctly()
        {
            var content = HttpContentHelper.FormUrlEncoded(new [, ] {
                { "key", "" }
            });
            var text = content.ReadAsStringAsync().Result;

            Assert.AreEqual("key=", text);
        }
예제 #4
0
        public void HttpContentHelper_FormUrlEncoded_Returns_FormUrlEncodedContent()
        {
            var content = HttpContentHelper.FormUrlEncoded(new [, ] {
                { "key1", "value1" },
                { "key2", "value2" },
            });
            var text = content.ReadAsStringAsync().Result;

            Assert.AreEqual("key1=value1&key2=value2", text);
        }
예제 #5
0
 public void HttpContentHelper_FormUrlEncoded_Throws_On_Second_Dimension_Too_Small()
 {
     HttpContentHelper.FormUrlEncoded(new [, ] {
         { "1" }
     });
 }
예제 #6
0
 public void HttpContentHelper_FormUrlEncoded_Throws_On_Null_Array()
 {
     HttpContentHelper.FormUrlEncoded(null);
 }