public void TestEditInherited() { SetUp(); var site = Path.Combine("Website1", "web.config"); var expected = "expected_edit.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")), new XElement("add", new XAttribute("duration", "00:00:00"), new XAttribute("extension", ".vb"))))); document.Save(expected); _feature.SelectedItem = _feature.Items[0]; Assert.Equal(".cs", _feature.SelectedItem.Extension); var item = _feature.SelectedItem; item.Extension = ".vb"; _feature.EditItem(item); Assert.NotNull(_feature.SelectedItem); Assert.Equal(".vb", _feature.SelectedItem.Extension); const string Original = @"original.config"; const string OriginalMono = @"original.mono.config"; XmlAssert.Equal(Helper.IsRunningOnMono() ? OriginalMono : Original, Current); XmlAssert.Equal(expected, site); }
public void TestEditInherited() { SetUp(); _feature.SelectedItem = _feature.Items[0]; Assert.Equal(".cs", _feature.SelectedItem.Extension); var item = _feature.SelectedItem; item.Extension = ".vb"; _feature.EditItem(item); Assert.NotNull(_feature.SelectedItem); Assert.Equal(".vb", _feature.SelectedItem.Extension); const string Original = @"original.config"; const string OriginalMono = @"original.mono.config"; XmlAssert.Equal(Helper.IsRunningOnMono() ? OriginalMono : Original, Current); XmlAssert.Equal(Path.Combine("Caching", "expected_edit.site.config"), Path.Combine("Website1", "web.config")); }
public void TestEdit() { SetUp(); const string Expected = @"expected_edit.config"; var document = XDocument.Load(Current); var node = document.Root.XPathSelectElement("/configuration/system.webServer/caching/profiles/add"); node?.SetAttributeValue("extension", ".doc"); document.Save(Expected); _feature.SelectedItem = _feature.Items[0]; var item = _feature.SelectedItem; item.Extension = ".doc"; _feature.EditItem(item); Assert.NotNull(_feature.SelectedItem); Assert.Equal(".doc", _feature.SelectedItem.Extension); Assert.Single(_feature.Items); XmlAssert.Equal(Expected, Current); }
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; item.Extension = ".doc"; _feature.EditItem(item); Assert.NotNull(_feature.SelectedItem); Assert.Equal(".doc", _feature.SelectedItem.Extension); Assert.Equal(1, _feature.Items.Count); XmlAssert.Equal( Helper.IsRunningOnMono() ? Path.Combine("Caching", ExpectedMono) : Path.Combine("Caching", Expected), Current); }