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 security = new XElement("security"); var request = new XElement("requestFiltering"); var limits = new XElement("requestLimits"); var header = new XElement("headerLimits"); var add = new XElement("remove"); add.SetAttributeValue("header", "test"); node?.Add(security); security.Add(request); request.Add(limits); limits.Add(header); header.Add(add); document.Save(expected); _feature.SelectedItem = _feature.Items[0]; Assert.Equal("test", _feature.SelectedItem.Header); _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); }
public async void TestRemoveInherited() { await this.SetUp(); _feature.SelectedItem = _feature.Items[0]; Assert.Equal("test", _feature.SelectedItem.Header); _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("RequestFiltering", "Headers", "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/security/requestFiltering/requestLimits"); node?.Remove(); document.Save(Expected); _feature.SelectedItem = _feature.Items[0]; _feature.Remove(); Assert.Null(_feature.SelectedItem); Assert.Empty(_feature.Items); 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(0, _feature.Items.Count); XmlAssert.Equal( Helper.IsRunningOnMono() ? Path.Combine("RequestFiltering", "Headers", ExpectedMono) : Path.Combine("RequestFiltering", "Headers", Expected), Current); }