public void TestEditInherited()
        {
            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("isapiFilters",
                                                       new XElement("remove",
                                                                    new XAttribute("name", "ASP.Net_2.0.50727-64")),
                                                       new XElement("filter",
                                                                    new XAttribute("enableCache", "true"),
                                                                    new XAttribute("preCondition", "bitness64,runtimeVersionv2.0"),
                                                                    new XAttribute("name", "ASP.Net_2.0.50727-64"),
                                                                    new XAttribute("path", "c:\\test.dll"))))));
            document.Save(Expected);

            _feature.SelectedItem = _feature.Items[0];
            Assert.Equal("ASP.Net_2.0.50727-64", _feature.SelectedItem.Name);
            var item = _feature.SelectedItem;

            item.Path = "c:\\test.dll";
            _feature.EditItem(item);
            Assert.NotNull(_feature.SelectedItem);
            Assert.Equal("c:\\test.dll", _feature.SelectedItem.Path);

            XmlAssert.Equal(Expected, Current);
            XmlAssert.Equal(Path.Combine("Website1", "original.config"), Path.Combine("Website1", "web.config"));
        }
        public async void TestEditInherited()
        {
            await this.SetUp();

            _feature.SelectedItem = _feature.Items[0];
            Assert.Equal("ASP.Net_2.0.50727-64", _feature.SelectedItem.Name);
            var item = _feature.SelectedItem;

            item.Path = "c:\\test.dll";
            _feature.EditItem(item);
            Assert.NotNull(_feature.SelectedItem);
            Assert.Equal("c:\\test.dll", _feature.SelectedItem.Path);

            const string Expected     = @"expected_edit.site.config";
            const string ExpectedMono = @"expected_edit.site.mono.config";

            XmlAssert.Equal(Path.Combine("IsapiFilters", Helper.IsRunningOnMono() ? ExpectedMono : Expected), Current);
            XmlAssert.Equal(Path.Combine("Website1", "original.config"), Path.Combine("Website1", "web.config"));
        }
Пример #3
0
        public async void TestEdit()
        {
            await this.SetUp();

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

            _feature.SelectedItem = _feature.Items[0];
            var item     = _feature.SelectedItem;
            var expected = "c:\\test.dll";

            item.Path = expected;
            _feature.EditItem(item);
            Assert.NotNull(_feature.SelectedItem);
            Assert.Equal(expected, _feature.SelectedItem.Path);
            Assert.Equal(5, _feature.Items.Count);
            XmlAssert.Equal(
                Helper.IsRunningOnMono()
                    ? Path.Combine("IsapiFilters", ExpectedMono)
                    : Path.Combine("IsapiFilters", Expected),
                Current);
        }
        public void TestEdit()
        {
            SetUp();
            const string Expected = @"expected_edit.config";
            var          document = XDocument.Load(Current);
            var          node     = document.Root.XPathSelectElement("/configuration/system.webServer/isapiFilters");
            var          element  = node?.FirstNode as XElement;

            element?.SetAttributeValue("path", "c:\\test.dll");
            document.Save(Expected);

            _feature.SelectedItem = _feature.Items[0];
            var item     = _feature.SelectedItem;
            var expected = "c:\\test.dll";

            item.Path = expected;
            _feature.EditItem(item);
            Assert.NotNull(_feature.SelectedItem);
            Assert.Equal(expected, _feature.SelectedItem.Path);
            Assert.Equal(5, _feature.Items.Count);
            XmlAssert.Equal(Expected, Current);
        }