public void AddingNodes_Test() { File.Copy("SmtpAgentConfig.xml", "SmtpAgentConfig.xml.test", true); XPath editor = new XPath(); editor.XmlFilePath = "SmtpAgentConfig.xml.test"; // // Ensure I am using it right // var actual = editor.SelectSingleAttribute("/SmtpAgentConfig/DomainManager/Url"); var expected = "http://localhost/ConfigService/DomainManagerService.svc/Domains"; Assert.Equal(expected, actual); actual = editor.SelectSingleAttribute("/SmtpAgentConfig/MdnMonitor/Url"); expected = null; Assert.Equal(expected, actual); editor.CreateFragment("/SmtpAgentConfig/MdnMonitor/Url"); editor.SetSingleAttribute("/SmtpAgentConfig/MdnMonitor/Url", @"http://localhost/ConfigService/MonitorService.svc/Dispositions"); actual = editor.SelectSingleAttribute("/SmtpAgentConfig/MdnMonitor/Url"); expected = @"http://localhost/ConfigService/MonitorService.svc/Dispositions"; Assert.Equal(expected, actual); }
public void RemovingBackupIpNode_Test() { File.Copy("SmtpAgentConfig.xml", "SmtpAgentConfig.xml.test", true); var editor = new XPath(); editor.XmlFilePath = "SmtpAgentConfig.xml.test"; var actual = editor.SelectSingleAttribute("/SmtpAgentConfig/PublicCerts/DnsResolver/BackupIpAddress"); Assert.Null(actual); editor.CreateFragment("/SmtpAgentConfig/PublicCerts/DnsResolver/BackupIpAddress"); var expected = "8.8.8.8"; editor.SetSingleAttribute("/SmtpAgentConfig/PublicCerts/DnsResolver/BackupIpAddress", expected); actual = editor.SelectSingleAttribute("/SmtpAgentConfig/PublicCerts/DnsResolver/BackupIpAddress"); Assert.Equal(expected, actual); // now delete editor.DeleteNode("/SmtpAgentConfig/PublicCerts/DnsResolver/BackupIpAddress"); actual = editor.SelectSingleAttribute("/SmtpAgentConfig/PublicCerts/DnsResolver/BackupIpAddress"); Assert.Null(actual); }
public void DeletingNodes_Test() { File.Copy("SmtpAgentConfig.xml", "SmtpAgentConfig.xml.test", true); XPath editor = new XPath(); editor.XmlFilePath = "SmtpAgentConfig.xml.test"; editor.CreateFragment("/SmtpAgentConfig/MdnMonitor/Url"); editor.SetSingleAttribute("/SmtpAgentConfig/MdnMonitor/Url", @"http://localhost/ConfigService/MonitorService.svc/Dispositions"); var actual = editor.SelectSingleAttribute("/SmtpAgentConfig/MdnMonitor/Url"); var expected = @"http://localhost/ConfigService/MonitorService.svc/Dispositions"; Assert.Equal(expected, actual); editor.DeleteFragment("/SmtpAgentConfig/MdnMonitor"); actual = editor.SelectSingleAttribute("/SmtpAgentConfig/MdnMonitor"); Assert.Null(actual); }
public void AddingNodes_Test() { File.Copy("SmtpAgentConfig.xml", "SmtpAgentConfig.xml.test", true); XPath editor = new XPath(); editor.XmlFilePath = "SmtpAgentConfig.xml.test"; // // Ensure I am using it right // var actual = editor.SelectSingleAttribute("/SmtpAgentConfig/DomainManager/Url"); var expected = "http://localhost/ConfigService/DomainManagerService.svc/Domains"; Assert.Equal(expected, actual); actual = editor.SelectSingleAttribute("/SmtpAgentConfig/MdnMonitor/Url"); expected = null; Assert.Equal(expected, actual); editor. CreateFragment("/SmtpAgentConfig/MdnMonitor/Url"); editor.SetSingleAttribute("/SmtpAgentConfig/MdnMonitor/Url", @"http://localhost/ConfigService/MonitorService.svc/Dispositions"); actual = editor.SelectSingleAttribute("/SmtpAgentConfig/MdnMonitor/Url"); expected = @"http://localhost/ConfigService/MonitorService.svc/Dispositions"; Assert.Equal(expected, actual); }