Example #1
0
        public async Task SendNotificationsForNewAlert_ShouldSendSmsToAllSupervisorsAndQueueCheckBack()
        {
            // arrange
            _testData.WhenAnAlertAreTriggered.GenerateData().AddToDbContext();
            var alert = _testData.WhenAnAlertAreTriggered.EntityData.Alerts.Single();
            var stringResourceResult = new Dictionary <string, string> {
                { SmsContentKey.Alerts.AlertTriggered, "Alert triggered!" }
            };

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

            // act
            await _alertService.SendNotificationsForNewAlert(alert, new GatewaySetting { ApiKey = "123" });

            // assert
            await _queuePublisherServiceMock.Received(1).QueueAlertCheck(alert.Id);
        }