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 file = new XElement("alwaysAllowedQueryStrings"); var remove = new XElement("remove"); remove.SetAttributeValue("queryString", "test"); node?.Add(security); security.Add(request); request.Add(file); file.Add(remove); document.Save(expected); _feature.SelectedItem = _feature.Items[0]; Assert.Equal("test", _feature.SelectedItem.QueryString); _feature.Remove(); Assert.Null(_feature.SelectedItem); Assert.Equal(1, _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 void TestRemove() { SetUp(); const string Expected = @"expected_remove.config"; var document = XDocument.Load(Current); var node = document.Root?.XPathSelectElement("/configuration/system.webServer/security/requestFiltering/alwaysAllowedQueryStrings"); node?.Remove(); document.Save(Expected); _feature.SelectedItem = _feature.Items[0]; _feature.Remove(); Assert.Null(_feature.SelectedItem); Assert.Single(_feature.Items); XmlAssert.Equal(Expected, Current); }
public async void TestRemoveInherited() { await this.SetUp(); _feature.SelectedItem = _feature.Items[0]; Assert.Equal("test", _feature.SelectedItem.QueryString); _feature.Remove(); Assert.Null(_feature.SelectedItem); Assert.Equal(1, _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", "QueryStrings", "expected_remove.site.config"), Path.Combine("Website1", "web.config")); }
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(1, _feature.Items.Count); XmlAssert.Equal( Helper.IsRunningOnMono() ? Path.Combine("RequestFiltering", "QueryStrings", ExpectedMono) : Path.Combine("RequestFiltering", "QueryStrings", Expected), Current); }