Ejemplo n.º 1
0
        public async Task SendsParametersAsJsonObjectInBody()
        {
            var parameters = new Dictionary <string, string>()
            {
                { "parm1", "one" },
                { "parm2", "two" }
            };

            await NewClient().PostAsync(IrrelevantEndpoint, parameters: parameters);

            TestHarnessRequest request = await clientRequest;

            Assert.AreEqual("{\"parm1\":\"one\",\"parm2\":\"two\"}", request.Body, "body");
            Assert.AreEqual("application/json; charset=utf-8", request.Headers["content-type"], "content-type header");
        }
Ejemplo n.º 2
0
        public async Task SetsHeaders()
        {
            var headers = new Dictionary <string, string>()
            {
                { "header1", "one" },
                { "header2", "two" },
            };

            await NewClient().PostAsync(IrrelevantEndpoint, headers: headers);

            TestHarnessRequest request = await clientRequest;

            Assert.AreEqual("one", request.Headers["header1"]);
            Assert.AreEqual("two", request.Headers["header2"]);
        }