public void ShouldFilter_ServerVariables_ByRegexAndName() { var logFilterSettings = new HttpContextDataLogFilterSettings { ServerVarFilters = new List <HttpContextDataLogFilter> { new HttpContextDataLogFilter { Name = "AUTH_U.*", ReplaceWith = "", NameIsRegex = true }, new HttpContextDataLogFilter { Name = "AUTH_PASSWORD", ReplaceWith = "***" }, } }; var ctxData = new HttpContextData(new ApplicationException("Test exception"), _context.Object, logFilterSettings); Assert.IsTrue(ctxData.ServerVariables.Count == 2); Assert.IsTrue(ctxData.ServerVariables["AUTH_PASSWORD"] == "***"); Assert.IsTrue(ctxData.ServerVariables["AUTH_TYPE"] == "Forms"); }
public void ShouldFilter_Cookies_ByRegexAndName() { var logFilterSettings = new HttpContextDataLogFilterSettings { CookieFilters = new List <HttpContextDataLogFilter> { new HttpContextDataLogFilter { Name = "COOKIE_1.*", ReplaceWith = "", NameIsRegex = true }, new HttpContextDataLogFilter { Name = "COOKIE_2", ReplaceWith = "" }, new HttpContextDataLogFilter { Name = "COOKIE_3", ReplaceWith = "***" }, }, }; var ctxData = new HttpContextData(new ApplicationException("Test exception"), _context.Object, logFilterSettings); Assert.IsTrue(ctxData.Cookies.Count == 2); Assert.IsTrue(ctxData.Cookies["COOKIE_3"] == "***"); Assert.IsTrue(ctxData.Cookies["COOKIE_4"] == "ck5"); }
public void ShouldFilter_Header_ByRegexAndName() { var logFilterSettings = new HttpContextDataLogFilterSettings { HeaderFilters = new List <HttpContextDataLogFilter> { new HttpContextDataLogFilter { Name = "HEADER_B_.*_B", ReplaceWith = "", NameIsRegex = true }, new HttpContextDataLogFilter { Name = "HEADER_C", ReplaceWith = "" }, new HttpContextDataLogFilter { Name = "HEADER_D", ReplaceWith = "***" }, }, }; var ctxData = new HttpContextData(new ApplicationException("Test exception"), _context.Object, logFilterSettings); Assert.IsTrue(ctxData.RequestHeaders.Count == 2); Assert.IsTrue(ctxData.RequestHeaders["HEADER_D"] == "***"); Assert.IsTrue(ctxData.RequestHeaders["HEADER_E"] == "H5"); }
public void ShouldFilter_FormData_ByRegexAndName() { var logFilterSettings = new HttpContextDataLogFilterSettings { FormFilters = new List <HttpContextDataLogFilter> { new HttpContextDataLogFilter { Name = "FORM_B_.*_B", ReplaceWith = "", NameIsRegex = true }, new HttpContextDataLogFilter { Name = "FORM_C", ReplaceWith = "" }, new HttpContextDataLogFilter { Name = "FORM_D", ReplaceWith = "***" }, }, }; var ctxData = new HttpContextData(new ApplicationException("Test exception"), _context.Object, logFilterSettings); Assert.IsTrue(ctxData.Form.Count == 2); Assert.IsTrue(ctxData.Form["FORM_D"] == "***"); Assert.IsTrue(ctxData.Form["FORM_E"] == "F5"); }