示例#1
0
        public async void JsonRequest_PutRequestTest()
        {
            const string endpoint = "https://httpbin.org/anything";
            const string jsonText = @"{ 
                    ""CaseID"": ""Unique File Name"",
                    ""Content"": ""StreamValue""
                    }";

            var request = new JsonRequest();

            var jsonBody = JToken.Parse(jsonText);

            var json = await request.PutAsync(endpoint, jsonBody);

            Assert.NotNull(json);

            var result = json.ToObject <BinResult>();

            Assert.NotNull(result);
            Assert.Equal("PUT", result.Method);
            Assert.Equal(endpoint, result.Url);
            Assert.Equal("Unique File Name", result.Json["CaseID"]?.Value <string>());
            Assert.Equal("StreamValue", result.Json["Content"]?.Value <string>());
        }