public void WebServiceNotificationContactTemplateTest() { var notificationContactTemplateName = $"{NotificationsFixture.TestPrefix}_{NotificationsFixture.TestInfix}_{nameof(WebServiceNotificationContactTemplateTest)}"; AFFixture.RemoveNotificationContactTemplateIfExists(notificationContactTemplateName, Output); try { Output.WriteLine($"Create web service notification contact template [{notificationContactTemplateName}]."); var nct = new AFNotificationContactTemplate(PISystem, notificationContactTemplateName) { DeliveryChannelPlugIn = WebServicePlugIn, ConfigString = "Style=SOAP;WebServiceName=Service;WebServiceMethod=Method;WebServiceUrl=http://localhost:9000", RetryInterval = TimeSpan.FromSeconds(30), MaximumRetries = 2, }; nct.CheckIn(); AFFixture.ReconnectToDB(); var nctId = nct.ID; var nct2 = PISystem.NotificationContactTemplates[nctId]; Output.WriteLine("Verify the properties of the created web service notification contact template."); Assert.True(nct2.DeliveryChannelPlugIn.Name == NotificationsFixture.WebServicePlugInName, "Delivery channel PlugIn is not WebService delivery channel PlugIn."); // SOAP style is implicit but authentication option is added automatically by default Assert.True( nct2.ConfigString == "AuthenticationOption=Windows;WebServiceMethod=Method;WebServiceName=Service;WebServiceURL=http://localhost:9000", "Delivery channel configuration string is not set properly."); Assert.True(nct2.RetryInterval == TimeSpan.FromSeconds(30), "Retry interval is not set properly."); Assert.True(nct2.MaximumRetries == 2, "Maximum retries is not set properly."); Output.WriteLine("Verify the web service notification contact template is added, configured and retrieved."); using (var contactTemplateEmailSearch = new AFNotificationContactTemplateSearch(PISystem, nameof(WebServiceNotificationContactTemplateTest), string.Empty)) { var rules = contactTemplateEmailSearch.FindObjects().Select(nr => nr.ID).ToArray(); Assert.True(rules.Contains(nctId), $"The created notification contact template [{notificationContactTemplateName}] is not found."); } } finally { AFFixture.RemoveNotificationContactTemplateIfExists(notificationContactTemplateName, Output); } }
public void EmailNotificationContactTemplateTest() { var notificationContactTemplateName = $"{NotificationsFixture.TestPrefix}_{NotificationsFixture.TestInfix}_{nameof(EmailNotificationContactTemplateTest)}"; var contactConfigString = "[email protected]"; AFFixture.RemoveNotificationContactTemplateIfExists(notificationContactTemplateName, Output); try { Output.WriteLine($"Create email notification contact template [{notificationContactTemplateName}]."); var nct = new AFNotificationContactTemplate(PISystem, notificationContactTemplateName) { DeliveryChannelPlugIn = EmailPlugIn, ConfigString = contactConfigString, RetryInterval = TimeSpan.FromSeconds(45), MaximumRetries = 3, }; nct.CheckIn(); AFFixture.ReconnectToDB(); var id = nct.ID; var nct2 = PISystem.NotificationContactTemplates[id]; Output.WriteLine("Verify the properties of the created notification contact template."); Assert.True(nct2.DeliveryChannelPlugIn.Name == NotificationsFixture.EmailPlugInName, "Delivery channel PlugIn is not Email delivery channel PlugIn."); Assert.True(nct2.ConfigString == contactConfigString, "Delivery channel configuration string is not set properly."); Assert.True(nct2.RetryInterval == TimeSpan.FromSeconds(45), "Retry interval is not set properly."); Assert.True(nct2.MaximumRetries == 3, "Maximum retries is not set properly."); Output.WriteLine("Verify the notification contact template is added and retrieved."); using (var contactTemplateEmailSearch = new AFNotificationContactTemplateSearch(PISystem, nameof(EmailNotificationContactTemplateTest), string.Empty)) { var rules = contactTemplateEmailSearch.FindObjects().Select(nr => nr.ID).ToArray(); Assert.True(rules.Contains(id), $"The created notification contact template [{notificationContactTemplateName}] is not found."); } } finally { AFFixture.RemoveNotificationContactTemplateIfExists(notificationContactTemplateName, Output); } }