public void TestEnable()
        {
            SetUp();

            const string Expected = @"expected_add.site.config";
            var          document = XDocument.Load(Current);
            var          node     = new XElement("location");

            node.SetAttributeValue("path", "WebSite1");
            document.Root?.Add(node);
            var web = new XElement("system.webServer");

            node.Add(web);
            var security = new XElement("security");

            web.Add(security);
            var authen = new XElement("authentication");

            security.Add(authen);
            var windows = new XElement("windowsAuthentication");

            windows.SetAttributeValue("enabled", true);
            authen.Add(windows);
            document.Save(Expected);

            _feature.Enable();
            Assert.True(_feature.IsEnabled);

            XmlAssert.Equal(Expected, Current);
            XmlAssert.Equal(Path.Combine("Website1", "original.config"), Path.Combine("Website1", "web.config"));
        }
Exemplo n.º 2
0
        public void TestEnable()
        {
            SetUp();
            const string Expected = @"expected_remove.config";
            var          document = XDocument.Load(Current);
            var          node     = document.Root?.XPathSelectElement("/configuration/system.webServer/security/authentication/windowsAuthentication");

            node?.SetAttributeValue("enabled", true);
            document.Save(Expected);

            _feature.Enable();
            Assert.True(_feature.IsEnabled);
            XmlAssert.Equal(Expected, Current);
        }
        public void TestEnable()
        {
            SetUp();

            const string Expected = @"expected_add.site.config";
            var          document = XDocument.Load(Current);

            document.Root?.Add(
                new XElement("location",
                             new XAttribute("path", "WebSite1"),
                             new XElement("system.webServer",
                                          new XElement("security",
                                                       new XElement("authentication",
                                                                    new XElement("windowsAuthentication",
                                                                                 new XAttribute("enabled", true)))))));
            document.Save(Expected);

            _feature.Enable();
            Assert.True(_feature.IsEnabled);

            XmlAssert.Equal(Expected, Current);
            XmlAssert.Equal(Path.Combine("Website1", "original.config"), Path.Combine("Website1", "web.config"));
        }