コード例 #1
0
        public void DefaultServiceAndSourceWithValidValuesIsSuccessfull()
        {
            const string testUrl = "https://demotest.DataDogDemo.com/PathSegment1/PathSegment2?queryStringParam1=qsp1Val";

            var decorationSource = new TestHttpDecorationSource(testUrl, "PuT", DefaultHeaders);

            var span = new TestSpan();

            DecorationService.Decorate(span, decorationSource);

            Assert.True(span.Type.Equals(SpanTypes.Web, StringComparison.Ordinal), "Type");
            Assert.True(span.GetTag(Tags.HttpMethod).Equals("PUT", StringComparison.Ordinal), "HttpMethod");
            Assert.True(span.GetHttpMethod().Equals("PUT", StringComparison.Ordinal), "GetHttpMethod");
            Assert.True(span.GetTag(Tags.HttpRequestHeadersHost).Equals(DefaultHost, StringComparison.Ordinal), "HttpRequestHeadersHost");
            Assert.True(span.GetTag(Tags.HttpUrl).Equals(testUrl.ToLowerInvariant(), StringComparison.Ordinal), "HttpUrl");
        }
コード例 #2
0
        public void DefaultServiceAndSourceWithMissingValuesIsSuccessfull()
        {
            const string testUrl = "https://demotest.DataDogDemo.com/PathSegment1/PathSegment2?queryStringParam1=qsp1Val";

            var headers = new Dictionary <string, string>(DefaultHeaders, StringComparer.OrdinalIgnoreCase);

            headers.Remove("Host");

            var decorationSource = new TestHttpDecorationSource(testUrl, null, headers);

            var span = new TestSpan();

            DecorationService.Decorate(span, decorationSource);

            Assert.True(span.Type.Equals(SpanTypes.Web, StringComparison.Ordinal), "Type");
            Assert.True(span.GetTag(Tags.HttpMethod).Equals("GET", StringComparison.Ordinal), "HttpMethod");
            Assert.True(span.GetHttpMethod().Equals("GET", StringComparison.Ordinal), "GetHttpMethod");
            Assert.True(span.GetTag(Tags.HttpRequestHeadersHost) == null, "HttpRequestHeadersHost");
            Assert.True(span.GetTag(Tags.HttpUrl).Equals(testUrl.ToLowerInvariant(), StringComparison.Ordinal), "HttpUrl");
        }