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"); var errors = new XElement("httpErrors"); var remove = new XElement("remove"); remove.SetAttributeValue("statusCode", "401"); node?.Add(errors); errors.Add(remove); document.Save(expected); _feature.SelectedItem = _feature.Items[0]; Assert.Equal(401U, _feature.SelectedItem.Status); _feature.Remove(); Assert.Null(_feature.SelectedItem); Assert.Equal(8, _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); }
public async void TestRemoveInherited() { await this.SetUp(); _feature.SelectedItem = _feature.Items[0]; Assert.Equal(401U, _feature.SelectedItem.Status); _feature.Remove(); Assert.Null(_feature.SelectedItem); Assert.Equal(8, _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("HttpErrors", "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/httpErrors"); node?.FirstNode.Remove(); document.Save(Expected); _feature.SelectedItem = _feature.Items[0]; _feature.Remove(); Assert.Null(_feature.SelectedItem); Assert.Equal(8, _feature.Items.Count); XmlAssert.Equal(Expected, Current); }
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(8, _feature.Items.Count); XmlAssert.Equal( Helper.IsRunningOnMono() ? Path.Combine("HttpErrors", ExpectedMono) : Path.Combine("HttpErrors", Expected), Current); }