public void ExecuteSucceeds() { var document = ResourceManager.Load(Assembly.GetExecutingAssembly(), "Be.Stateless.Resources.web-original.config", XDocument.Load); var action = new ConfigurationElementDeletionAction("/configuration/appSettings/add[@key='first_setting']"); action.Execute(document); document.XPathSelectElement("/configuration/appSettings/add[@key='first_setting']").Should().BeNull(); }
public void ExecuteFailedWhenElementIsNotEmpty() { var document = ResourceManager.Load(Assembly.GetExecutingAssembly(), "Be.Stateless.Resources.web-original.config", XDocument.Load); var action = new ConfigurationElementDeletionAction("/configuration/appSettings"); Invoking(() => action.Execute(document)) .Should().Throw <InvalidOperationException>() .WithMessage("The configuration element '/configuration/appSettings' has at least one child element."); }