コード例 #1
0
        public void AddPostKeyRawGetPostBufferTest()
        {
            var client = new HttpClient();

            client.ContentType = "application/x-www-form-urlencoded";

            // raw POST buffer
            client.AddPostKey("name=Rick&company=West%20Wind");

            string post = client.GetPostBuffer();

            Console.WriteLine(post);

            Assert.IsTrue(post == "name=Rick&company=West%20Wind");
        }
コード例 #2
0
        public void AddPostKeyGetPostBufferTest()
        {
            var client = new HttpClient();

            client.ContentType = "application/x-www-form-urlencoded";

            client.AddPostKey("ctl00_Content_Username", "Rick");
            client.AddPostKey("ctl00_Content_Password", "seekrit");

            string post = client.GetPostBuffer();

            Console.WriteLine(post);

            Assert.IsTrue(post.Contains("&ctl00_Content_Password="));
        }