예제 #1
0
        public void GetObfuscatedServerVariablesNullContext()
        {
            // Arrange and Act
            var serverVariables = QuietLog.GetObfuscatedServerVariables(null);

            // Assert
            Assert.Null(serverVariables);
        }
예제 #2
0
        public void GetObfuscatedServerVariablesNullRequestContext()
        {
            // Arange
            var context = new TestHttpContextNullRequestContext();

            // Act
            var serverVariables = QuietLog.GetObfuscatedServerVariables(context);

            // Assert
            Assert.Null(serverVariables);
        }
예제 #3
0
        public void GetObfuscatedServerVariablesValidCase(string controller, string action)
        {
            // Arange
            RouteData route = new RouteData();

            route.Values.Add("controller", controller);
            route.Values.Add("action", action);

            var context = new TestHttpContext(route);

            // Act
            var serverVariables = QuietLog.GetObfuscatedServerVariables(context);

            // Assert
            Assert.Equal <string>(Obfuscator.DefaultObfuscatedUrl(context.Request.Url), serverVariables["HTTP_REFERER"]);
            Assert.Equal <string>(context.Operation, serverVariables["PATH_INFO"]);
            Assert.Equal <string>(context.Operation, serverVariables["PATH_TRANSLATED"]);
            Assert.Equal <string>(context.Operation, serverVariables["SCRIPT_NAME"]);
            Assert.Equal <string>(Obfuscator.DefaultObfuscatedUrl(context.Request.Url), serverVariables["URL"]);
        }