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("httpErrors", new XElement("remove", new XAttribute("statusCode", "401")), new XElement("error", new XAttribute("prefixLanguageFilePath", "%IIS_BIN%\\custerr"), new XAttribute("statusCode", "401"), new XAttribute("path", "c:\\test.htm")))); document.Save(expected); _feature.SelectedItem = _feature.Items[0]; Assert.Equal("401.htm", _feature.SelectedItem.Path); var item = _feature.SelectedItem; var expectedValue = "c:\\test.htm"; item.Path = expectedValue; _feature.EditItem(item); Assert.NotNull(_feature.SelectedItem); Assert.Equal(expectedValue, _feature.SelectedItem.Path); const string Original = @"original.config"; const string OriginalMono = @"original.mono.config"; XmlAssert.Equal(Helper.IsRunningOnMono() ? OriginalMono : Original, Current); XmlAssert.Equal(expected, site); }
public async void TestEditInherited() { await this.SetUp(); _feature.SelectedItem = _feature.Items[0]; Assert.Equal("401.htm", _feature.SelectedItem.Path); var item = _feature.SelectedItem; var expected = "c:\\test.htm"; item.Path = expected; _feature.EditItem(item); Assert.NotNull(_feature.SelectedItem); Assert.Equal(expected, _feature.SelectedItem.Path); const string Original = @"original.config"; const string OriginalMono = @"original.mono.config"; XmlAssert.Equal(Helper.IsRunningOnMono() ? OriginalMono : Original, Current); XmlAssert.Equal(Path.Combine("HttpErrors", "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/httpErrors"); var element = node?.FirstNode as XElement; element?.SetAttributeValue("path", "c:\\test.htm"); document.Save(Expected); _feature.SelectedItem = _feature.Items[0]; var item = _feature.SelectedItem; item.Path = "c:\\test.htm"; _feature.EditItem(item); Assert.NotNull(_feature.SelectedItem); Assert.Equal("c:\\test.htm", _feature.SelectedItem.Path); Assert.Equal(9, _feature.Items.Count); 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.Path = "c:\\test.htm"; _feature.EditItem(item); Assert.NotNull(_feature.SelectedItem); Assert.Equal("c:\\test.htm", _feature.SelectedItem.Path); Assert.Equal(9, _feature.Items.Count); XmlAssert.Equal( Helper.IsRunningOnMono() ? Path.Combine("HttpErrors", ExpectedMono) : Path.Combine("HttpErrors", Expected), Current); }