public ConfigurationElementUpsertionAction( string configurationElementSelector, ConfigurationElementInsertionAction insertionAction, ConfigurationElementUpdateAction updateAction) : base(configurationElementSelector) { InsertionAction = insertionAction ?? throw new ArgumentNullException(nameof(insertionAction)); UpdateAction = updateAction ?? throw new ArgumentNullException(nameof(updateAction)); }
public void ExecuteSucceedsWithKey() { var document = ResourceManager.Load(Assembly.GetExecutingAssembly(), "Be.Stateless.Resources.web-original.config", XDocument.Load); var action = new ConfigurationElementUpdateAction( "/configuration/appSettings/add[@key='first_setting']", new[] { new XAttribute("value", "updated-value") }); action.Execute(document); document.XPathSelectElement("/configuration/appSettings/add[@key='first_setting' and @value='updated-value']").Should().NotBeNull(); }
public void ExecuteSucceeds() { var document = ResourceManager.Load(Assembly.GetExecutingAssembly(), "Be.Stateless.Resources.web-original.config", XDocument.Load); var action = new ConfigurationElementUpdateAction( "/configuration", new[] { new XAttribute("{urn:test}test", "value") }); action.Execute(document); document.XPathSelectElement("/configuration[@*[local-name() = 'test' and namespace-uri()='urn:test']]").Should().NotBeNull(); }