Example #1
0
        public async Task CheckAlert_WhenAlertIsNoLongerPending_ShouldNotNotifyHeadManager(AlertStatus alertStatus)
        {
            // arrange
            _testData.WhenAnAlertAreTriggered.GenerateData().AddToDbContext();
            var alert = _testData.WhenAnAlertAreTriggered.EntityData.Alerts.Single();

            alert.Status = alertStatus;
            var stringResourceResult = new Dictionary <string, string>
            {
                { EmailContentKey.AlertHasNotBeenHandled.Subject, "Alert escalated subject" },
                { EmailContentKey.AlertHasNotBeenHandled.Body, "Alert escalated body" }
            };

            _stringsResourcesServiceMock.GetEmailContentResources(Arg.Any <string>())
            .Returns(Result.Success <IDictionary <string, string> >(stringResourceResult));
            _nyssReportApiConfigMock.BaseUrl = "http://example.com";

            // act
            await _alertService.CheckIfAlertHasBeenHandled(alert.Id);

            // assert
            await _queuePublisherServiceMock.DidNotReceive().SendEmail(Arg.Any <(string, string)>(), Arg.Any <string>(), Arg.Any <string>());
        }