public void TestRemoveInherited()
        {
            SetUp();

            var site     = Path.Combine("Website1", "web.config");
            var expected = "expected_remove.site.config";
            var document = XDocument.Load(site);
            var node     = document.Root?.XPathSelectElement("/configuration/system.webServer");

            node?.Add(
                new XElement("security",
                             new XElement("requestFiltering",
                                          new XElement("hiddenSegments",
                                                       new XElement("remove",
                                                                    new XAttribute("segment", "web.config"))))));
            document.Save(expected);

            _feature.SelectedItem = _feature.Items[0];
            Assert.Equal("web.config", _feature.SelectedItem.Segment);
            _feature.Remove();
            Assert.Null(_feature.SelectedItem);
            Assert.Equal(7, _feature.Items.Count);

            const string Original     = @"original.config";
            const string OriginalMono = @"original.mono.config";

            XmlAssert.Equal(Helper.IsRunningOnMono() ? OriginalMono : Original, Current);
            XmlAssert.Equal(expected, site);
        }
Пример #2
0
        public async void TestRemoveInherited()
        {
            await this.SetUp();

            _feature.SelectedItem = _feature.Items[0];
            Assert.Equal("web.config", _feature.SelectedItem.Segment);
            _feature.Remove();
            Assert.Null(_feature.SelectedItem);
            Assert.Equal(7, _feature.Items.Count);

            const string Original     = @"original.config";
            const string OriginalMono = @"original.mono.config";

            XmlAssert.Equal(Helper.IsRunningOnMono() ? OriginalMono : Original, Current);
            XmlAssert.Equal(Path.Combine("RequestFiltering", "HiddenSegments", "expected_remove.site.config"), Path.Combine("Website1", "web.config"));
        }
Пример #3
0
        public void TestRemove()
        {
            SetUp();
            const string Expected = @"expected_remove.config";
            var          document = XDocument.Load(Current);
            var          node     = document.Root?.XPathSelectElement("/configuration/system.webServer/security/requestFiltering/hiddenSegments");

            node?.FirstNode.Remove();
            document.Save(Expected);

            _feature.SelectedItem = _feature.Items[0];
            _feature.Remove();
            Assert.Null(_feature.SelectedItem);
            Assert.Equal(7, _feature.Items.Count);
            XmlAssert.Equal(Expected, Current);
        }
Пример #4
0
        public async void TestRemove()
        {
            await this.SetUp();

            const string Expected     = @"expected_remove.config";
            const string ExpectedMono = @"expected_remove.mono.config";

            _feature.SelectedItem = _feature.Items[0];
            _feature.Remove();
            Assert.Null(_feature.SelectedItem);
            Assert.Equal(7, _feature.Items.Count);
            XmlAssert.Equal(
                Helper.IsRunningOnMono()
                    ? Path.Combine("RequestFiltering", "HiddenSegments", ExpectedMono)
                    : Path.Combine("RequestFiltering", "HiddenSegments", Expected),
                Current);
        }