コード例 #1
0
        public void HttpResponseMessageAsFormattedStringHandlesEmptyRequests()
        {
            using (var httpRequest = new HttpResponseMessage())
            {
                var formattedString = CloudTracingExtensions.AsFormattedString(httpRequest);

                Assert.Contains("StatusCode: 200", formattedString);
            }
        }
コード例 #2
0
        public void HttpRequestMessageAsFormattedStringHandlesEmptyRequests()
        {
            using (var httpRequest = new HttpRequestMessage())
            {
                var formattedString = CloudTracingExtensions.AsFormattedString(httpRequest);

                Assert.Contains("Method: GET", formattedString);
            }
        }
コード例 #3
0
        public void HttpResponseMessageAsFormattedStringHandlesRequestsWithHeaders()
        {
            using (var httpRequest = new HttpResponseMessage(HttpStatusCode.OK))
            {
                httpRequest.Headers.Add("x-ms-version", "2013-11-01");
                var formattedString = CloudTracingExtensions.AsFormattedString(httpRequest);

                Assert.Contains("StatusCode: 200", formattedString);
                Assert.Contains("x-ms-version: 2013-11-01", formattedString);
            }
        }
コード例 #4
0
        public void DictionaryAsFormattedStringWorksWithNulls()
        {
            var parameters = new Dictionary <string, object>();

            parameters["a"] = 1;
            parameters["b"] = "str";
            parameters["c"] = null;
            var formattedString = CloudTracingExtensions.AsFormattedString(parameters);

            Assert.Equal("{a=1,b=str,c=}", formattedString);
        }
コード例 #5
0
        public void DictionaryAsFormattedStringReturnsSet()
        {
            var parameters = new Dictionary <string, object>();

            parameters["a"] = 1;
            parameters["b"] = "str";
            parameters["c"] = true;
            var formattedString = CloudTracingExtensions.AsFormattedString(parameters);

            Assert.Equal("{a=1,b=str,c=True}", formattedString);
        }
コード例 #6
0
        public void HttpResponseMessageAsFormattedStringHandlesRequestsWithContent()
        {
            using (var httpRequest = new HttpResponseMessage(HttpStatusCode.OK))
            {
                httpRequest.Content = new StringContent("<body/>");
                var formattedString = CloudTracingExtensions.AsFormattedString(httpRequest);

                Assert.Contains("StatusCode: 200", formattedString);
                Assert.Contains("<body/>", formattedString);
            }
        }
コード例 #7
0
        public void HttpRequestMessageAsFormattedStringHandlesRequestsWithContent()
        {
            using (var httpRequest = new HttpRequestMessage(HttpMethod.Get, "http://www.windowsazure.com/test"))
            {
                httpRequest.Content = new StringContent("<body/>");
                var formattedString = CloudTracingExtensions.AsFormattedString(httpRequest);

                Assert.Contains("Method: GET", formattedString);
                Assert.Contains("RequestUri: 'http://www.windowsazure.com/test'", formattedString);
                Assert.Contains("<body/>", formattedString);
            }
        }
コード例 #8
0
        public void HttpRequestMessageAsFormattedStringHandlesRequestsWithHeaders()
        {
            using (var httpRequest = new HttpRequestMessage(HttpMethod.Get, "http://www.windowsazure.com/test"))
            {
                httpRequest.Headers.Add("x-ms-version", "2013-11-01");
                var formattedString = CloudTracingExtensions.AsFormattedString(httpRequest);

                Assert.Contains("Method: GET", formattedString);
                Assert.Contains("RequestUri: 'http://www.windowsazure.com/test'", formattedString);
                Assert.Contains("x-ms-version: 2013-11-01", formattedString);
            }
        }
コード例 #9
0
 public void HttpResponseMessageAsFormattedStringThrowsArgumentNullException()
 {
     Assert.Throws <ArgumentNullException>(() => CloudTracingExtensions.AsFormattedString((HttpResponseMessage)null));
 }
コード例 #10
0
        public void DictionaryAsFormattedStringReturnsEmptyBracesForEmptySet()
        {
            var formattedString = CloudTracingExtensions.AsFormattedString(new Dictionary <string, object>());

            Assert.Equal("{}", formattedString);
        }
コード例 #11
0
        public void DictionaryAsFormattedStringReturnsEmptyBracesForNull()
        {
            var formattedString = CloudTracingExtensions.AsFormattedString((Dictionary <string, object>)null);

            Assert.Equal("{}", formattedString);
        }