public void InformationLogsEventWithMessage(string message)
        {
            EtwTracingHelper("Information", new[] { "Message" },
                () =>
                {
                    EtwTracingInterceptor etwTracer = new EtwTracingInterceptor();
                    etwTracer.Information(message);
                },
                (dict) =>
                {
                    message = message ?? string.Empty;

                    Assert.Equal(message, dict["Message"]);
                });
        }
        public void ConfigurationLogsEventWithAllParameters(string source, string name, string value)
        {
            EtwTracingHelper("Configuration", new[] { "Source", "Name", "Value" },
                () =>
                {
                    EtwTracingInterceptor etwTracer = new EtwTracingInterceptor();
                    etwTracer.Configuration(source, name, value);
                },
                (dict) =>
                {
                    source = source ?? string.Empty;
                    name = name ?? string.Empty;
                    value = value ?? string.Empty;

                    Assert.Equal(source, dict["Source"]);
                    Assert.Equal(name, dict["Name"]);
                    Assert.Equal(value, dict["Value"]);
                });
        }
        public void EnterLogsEventWithNonNullParams()
        {
            Dictionary<string, object> parameters = new Dictionary<string, object>();
            parameters["a"] = 1;
            parameters["b"] = "str";
            parameters["c"] = true;


            EtwTracingHelper("Enter", new[] { "InvocationId", "Instance", "Method", "Parameters" },
                () =>
                {
                    EtwTracingInterceptor etwTracer = new EtwTracingInterceptor();
                    etwTracer.Enter("1", 23, "main", parameters);
                },
                (dict) =>
                {
                    Assert.Equal("1", dict["InvocationId"]);
                    Assert.Equal("23", dict["Instance"]);
                    Assert.Equal("main", dict["Method"]);
                    Assert.Equal("{a=1,b=str,c=True}", dict["Parameters"]);
                });
        }
 public void ExitLogsEventWithNullRequest()
 {
     EtwTracingHelper("Exit", new[] { "InvocationId", "ReturnValue" },
         () =>
         {
             EtwTracingInterceptor etwTracer = new EtwTracingInterceptor();
             etwTracer.Exit(null, null);
         },
         (dict) =>
         {
             Assert.Equal("", dict["InvocationId"]);
             Assert.Equal("", dict["ReturnValue"]);
         });
 }
 public void ReceiveResponseLogsEventWithNullRequest()
 {
     EtwTracingHelper("ReceiveResponse", new[] { "InvocationId", "Response" },
         () =>
         {
             EtwTracingInterceptor etwTracer = new EtwTracingInterceptor();
             etwTracer.ReceiveResponse(null, null);
         },
         (dict) =>
         {
             Assert.Equal("", dict["InvocationId"]);
             Assert.Equal("", dict["Response"]);
         });
 }
        public void ReceiveResponseLogsEventWithNonNullRequest()
        {
            using (var httpRequest = new HttpResponseMessage(System.Net.HttpStatusCode.OK))
            {
                httpRequest.Content = new StringContent("<body/>");

                EtwTracingHelper("ReceiveResponse", new[] { "InvocationId", "Response" },
                    () =>
                    {
                        EtwTracingInterceptor etwTracer = new EtwTracingInterceptor();
                        etwTracer.ReceiveResponse("1", httpRequest);
                    },
                    (dict) =>
                    {
                        Assert.Equal("1", dict["InvocationId"]);
                        Assert.Contains("<body/>", dict["Response"]);
                    });
            }
        }
        public void SendRequestLogsEventWithNonNullRequest()
        {
            var httpRequest = new HttpRequestMessage(HttpMethod.Get, "http://www.windowsazure.com/test");
            httpRequest.Headers.Add("x-ms-version", "2013-11-01");

            EtwTracingHelper("SendRequest", new[] { "InvocationId", "Request" },
                () =>
                {
                    EtwTracingInterceptor etwTracer = new EtwTracingInterceptor();
                    etwTracer.SendRequest("1", httpRequest);
                },
                (dict) =>
                {
                    Assert.Equal("1", dict["InvocationId"]);
                    Assert.Contains("RequestUri: 'http://www.windowsazure.com/test'", dict["Request"]);
                    Assert.Contains("x-ms-version: 2013-11-01", dict["Request"]);
                });
        }