public void shoulddeserializewhitelistfromexistingxmlfile()
		{
			// Arrange
			string whitelistFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Unit", "Text", "whitelist.xml");
			ApplicationSettings settings = new ApplicationSettings();
			settings.HtmlElementWhiteListPath = whitelistFile;

			string htmlFragment = "<test href=\"http://www.google.com\">link</test> <blah id=\"myid\" class=\"class1 class2\">somediv</blah><a href=\"test\">test</a>";

			// Act
			MarkupSanitizer sanitizer = new MarkupSanitizer(settings);
			sanitizer.SetWhiteListCacheKey("ShouldDeserializeWhiteListFromExistingXmlFile");
			string actual = sanitizer.SanitizeHtml(htmlFragment);

			// Assert
			string expected = "<test href=\"http&#x3A;&#x2F;&#x2F;www&#x2E;google&#x2E;com\">link</test> <blah id=\"myid\" class=\"class1&#x20;class2\">somediv</blah>";
			Assert.That(actual, Is.EqualTo(expected).IgnoreCase);
		}
        public void ShouldDeserializeWhiteListFromGeneratedXmlFile()
        {
            // Arrange
            string whitelistFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "whitelistgenerated.xml");
            ApplicationSettings settings = new ApplicationSettings();
            settings.HtmlElementWhiteListPath = whitelistFile;

            using (FileStream stream = new FileStream(whitelistFile, FileMode.Create, FileAccess.Write))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(HtmlWhiteList));

                List<HtmlElement> list = new List<HtmlElement>();
                list.Add(new HtmlElement("blah", new string[] { "id", "class" }));
                list.Add(new HtmlElement("test", new string[] { "href" }));

                HtmlWhiteList whiteList = new HtmlWhiteList();
                whiteList.ElementWhiteList = list;

                serializer.Serialize(stream, whiteList);
            }

            string htmlFragment = "<test href=\"http://www.google.com\">link</test> <blah id=\"myid\" class=\"class1 class2\">somediv</blah><a href=\"test\">test</a>";

            // Act
            MarkupSanitizer sanitizer = new MarkupSanitizer(settings);
            sanitizer.SetWhiteListCacheKey("ShouldDeserializeWhiteListFromGeneratedXmlFile");
            string actual = sanitizer.SanitizeHtml(htmlFragment);

            // Assert
            string expected = "<test href=\"http&#x3A;&#x2F;&#x2F;www&#x2E;google&#x2E;com\">link</test> <blah id=\"myid\" class=\"class1&#x20;class2\">somediv</blah>";
            Assert.That(actual, Is.EqualTo(expected).IgnoreCase);
        }