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("caching",
                             new XElement("profiles",
                                          new XElement("remove",
                                                       new XAttribute("extension", ".cs")))));
            document.Save(expected);

            _feature.SelectedItem = _feature.Items[0];
            Assert.Equal(".cs", _feature.SelectedItem.Extension);
            _feature.Remove();
            Assert.Null(_feature.SelectedItem);
            Assert.Empty(_feature.Items);

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

            XmlAssert.Equal(Helper.IsRunningOnMono() ? OriginalMono : Original, Current);
            XmlAssert.Equal(expected, site);
        }
Example #2
0
        public void TestRemoveInherited()
        {
            SetUp();

            _feature.SelectedItem = _feature.Items[0];
            Assert.Equal(".cs", _feature.SelectedItem.Extension);
            _feature.Remove();
            Assert.Null(_feature.SelectedItem);
            Assert.Equal(0, _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("Caching", "expected_remove.site.config"), Path.Combine("Website1", "web.config"));
        }
        public void TestRemove()
        {
            SetUp();
            const string Expected = @"expected_remove.config";
            var          document = XDocument.Load(Current);
            var          node     = document.Root.XPathSelectElement("/configuration/system.webServer/caching");

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

            _feature.SelectedItem = _feature.Items[0];
            _feature.Remove();
            Assert.Null(_feature.SelectedItem);
            Assert.Empty(_feature.Items);
            XmlAssert.Equal(Expected, Current);
        }
Example #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(0, _feature.Items.Count);
            XmlAssert.Equal(
                Helper.IsRunningOnMono()
                    ? Path.Combine("Caching", ExpectedMono)
                    : Path.Combine("Caching", Expected),
                Current);
        }