public void NotificationRuleResendWebServiceStopsOnAcknowledgmentTest() { Assert.True(NotificationsFixture.SoapWebServiceHost != null, "The Web Service host couldn't be started."); AFDatabase db = AFFixture.AFDatabase; var elementName = $"{NotificationsFixture.TestPrefix}_{NotificationsFixture.TestInfix}_{nameof(NotificationRuleResendWebServiceStopsOnAcknowledgmentTest)}"; var eventFrameTemplateName = $"{NotificationsFixture.TestPrefix}_{NotificationsFixture.TestInfix}_EventFrameTemplate1"; var notificationRuleName = $"{NotificationsFixture.TestPrefix}_{NotificationsFixture.TestInfix}_NotificationRule1"; var eventFrameName = $"{NotificationsFixture.TestPrefix}_{NotificationsFixture.TestInfix}_EventFrame1"; AFFixture.RemoveElementIfExists(elementName, Output); AFFixture.RemoveElementTemplateIfExists(eventFrameTemplateName, Output); Guid?eventFrameId = null; try { Output.WriteLine($"Create event frame template [{eventFrameTemplateName}] and element [{elementName}] with notification rule [{notificationRuleName}]."); var efTemplate = db.ElementTemplates.Add(eventFrameTemplateName); efTemplate.InstanceType = typeof(AFEventFrame); efTemplate.CanBeAcknowledged = true; var element = db.Elements.Add(elementName); var notificationRule = element.NotificationRules.Add(notificationRuleName); notificationRule.Criteria = $"Template:{eventFrameTemplateName}"; notificationRule.ResendInterval = TimeSpan.FromSeconds(30); var format = notificationRule.DeliveryFormats.Add("testFormat", WebServicePlugIn); NotificationsFixture.SetFormatProperties(format.Properties, nameof(NotificationRuleResendWebServiceStopsOnAcknowledgmentTest)); var webServiceEndpoint = NotificationsFixture.GetSoapWebServiceEndpoint(); var subscriber = notificationRule.Subscribers.Add(webServiceEndpoint); subscriber.DeliveryFormat = format; subscriber.NotifyOption = AFNotifyOption.EventStartAndEnd; notificationRule.SetStatus(AFStatus.Enabled); db.CheckIn(); Output.WriteLine("Waiting for notification to startup."); Thread.Sleep(TimeSpan.FromSeconds(10)); var eventFrame = new AFEventFrame(db, eventFrameName, efTemplate) { PrimaryReferencedElement = element, }; Output.WriteLine($"Create event frame [{eventFrameName}]."); eventFrame.SetStartTime(AFTime.Now); eventFrame.CheckIn(); eventFrameId = eventFrame.ID; Output.WriteLine("Event frame start send."); var msg = NotificationsFixture.Service.WaitForMessage(TimeSpan.FromMinutes(1)); Assert.True(notificationRule.ID == msg.NotificationRuleId, "Notification rule is not set properly."); Assert.True(msg.Content == nameof(NotificationRuleResendWebServiceStopsOnAcknowledgmentTest), "The message content is not set properly."); Output.WriteLine($"Acknowledge the event frame with the Id: {eventFrameId}"); eventFrame.Acknowledge(); eventFrame.CheckIn(); var foundMessage = NotificationsFixture.Service.TryWaitForMessage(TimeSpan.FromMinutes(1), out msg); Assert.False(foundMessage, $"Notification rule should not resend if acknowledged, but found message for notification rule with the Id: [{msg?.NotificationRuleId}]."); } finally { AFFixture.RemoveElementTemplateIfExists(eventFrameTemplateName, Output); AFFixture.RemoveElementIfExists(elementName, Output); if (eventFrameId != null) { AFFixture.RemoveEventFrameIfExists(eventFrameId.GetValueOrDefault(), Output); } } }