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()); }
public void HttpContentHelper_FormUrlEncoded_Encodes_Values() { var content = HttpContentHelper.FormUrlEncoded(new [, ] { { "key", "&" } }); var text = content.ReadAsStringAsync().Result; Assert.AreEqual("key=%26", text); }
public void HttpContentHelper_FormUrlEncoded_Handles_Empty_Value_Correctly() { var content = HttpContentHelper.FormUrlEncoded(new [, ] { { "key", "" } }); var text = content.ReadAsStringAsync().Result; Assert.AreEqual("key=", text); }
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); }
public void HttpContentHelper_FormUrlEncoded_Throws_On_Second_Dimension_Too_Small() { HttpContentHelper.FormUrlEncoded(new [, ] { { "1" } }); }
public void HttpContentHelper_FormUrlEncoded_Throws_On_Null_Array() { HttpContentHelper.FormUrlEncoded(null); }