public void TestCookie()
        {
            const string CookieName = "ASP.NET_SessionId";

            var configurationSection = new MaskedValuesConfigurationSection();
            configurationSection.RemoveAspxAuth = false;
            configurationSection.ReplacementText = "OBSCURED";
            configurationSection.Cookies.Add(new MaskedItemElement(CookieName));

            using (HttpSimulator simulator = new HttpSimulator("/", @"c:\inetpub\"))
            {
                simulator.SetCookies(Cookies)
                         .SimulateRequest(new Uri("http://localhost/"));

                var error = new Error(new HttpRequestValidationException(), HttpContext.Current);

                Assert.IsNotNull(HttpContext.Current.Request.Cookies[CookieName]);

                ErrorHelper.Obscure(error, configurationSection);

                Assert.AreEqual(configurationSection.ReplacementText, error.Cookies[CookieName]);

                Assert.AreNotEqual(configurationSection.ReplacementText, error.Cookies[MaskedValuesConfigurationSection.AspxAuthCookie]);
            }
        }
        public void TestAspxAuth()
        {
            var configurationSection = new MaskedValuesConfigurationSection();
            configurationSection.RemoveAspxAuth = true;
            configurationSection.ReplacementText = "OBSCURED";

            using (HttpSimulator simulator = new HttpSimulator("/", @"c:\inetpub\"))
            {
                simulator.SetCookies(Cookies)
                         .SimulateRequest(new Uri("http://localhost/"));

                var error = new Error(new HttpRequestValidationException(), HttpContext.Current);

                ErrorHelper.Obscure(error, configurationSection);

                Assert.AreEqual(configurationSection.ReplacementText, error.Cookies[MaskedValuesConfigurationSection.AspxAuthCookie]);
            }
        }