public void TestRevert() { SetUp(); var exception = Assert.Throws <InvalidOperationException>(() => _feature.Revert()); Assert.Equal("Revert operation cannot be done at server level", exception.Message); }
public void TestRevert() { SetUp(); const string Expected = @"expected_add.site.config"; var document = XDocument.Load(Current); var node = new XElement("location"); node.SetAttributeValue("path", "WebSite1"); document.Root?.Add(node); var web = new XElement("system.webServer"); node.Add(web); var security = new XElement("security"); web.Add(security); document.Save(Expected); var item = new IpSecurityItem(null); item.Address = "12.0.0.0"; _feature.AddItem(item); Assert.NotNull(_feature.SelectedItem); Assert.Equal("12.0.0.0", _feature.SelectedItem.Address); _feature.Revert(); Assert.Null(_feature.SelectedItem); Assert.Single(_feature.Items); XmlAssert.Equal(Expected, Current); XmlAssert.Equal(Path.Combine("Website1", "original.config"), Path.Combine("Website1", "web.config")); }
public async void TestRevert() { await SetUp(); var item = new IpSecurityItem(null); item.Address = "12.0.0.0"; _feature.AddItem(item); Assert.NotNull(_feature.SelectedItem); Assert.Equal("12.0.0.0", _feature.SelectedItem.Address); _feature.Revert(); Assert.Null(_feature.SelectedItem); Assert.Equal(1, _feature.Items.Count); const string Expected = @"expected_revert.site.config"; const string ExpectedMono = @"expected_revert.site.mono.config"; XmlAssert.Equal(Path.Combine("IpSecurity", Helper.IsRunningOnMono() ? ExpectedMono : Expected), Current); XmlAssert.Equal(Path.Combine("Website1", "original.config"), Path.Combine("Website1", "web.config")); }