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

            var request = new TestWebRequest <JObject>(endpoint);

            var jsonBody = JToken.Parse(jsonText);

            var json = await request.PutAsync(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>());
        }