Пример #1
0
        public async void JsonRequest_PostRequestTest()
        {
            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.PostAsync(endpoint, jsonBody);

            Assert.NotNull(json);

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

            Assert.NotNull(result);
            Assert.Equal("POST", 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>());
        }