Пример #1
0
        public async Task ResendEmailNotificatoinByDateRangeTest_ValidInput()
        {
            var notificationItems = this.GetEmailNotificationItemEntities();

            _ = this.emailManager.Setup(x => x.GetEmailNotificationsByDateRangeAndStatus(It.IsAny <string>(), It.IsAny <DateTimeRange>(), It.IsAny <List <NotificationItemStatus> >())).ReturnsAsync(notificationItems);
            var classUnderTest = new EmailHandlerManager(this.configuration, this.msGraphSettingOptions.Object, this.cloudStorageClient.Object, this.logger.Object, this.emailManager.Object);
            var result         = await classUnderTest.ResendEmailNotificationsByDateRange(this.applicationName, this.dateRange);

            Assert.IsNotNull(result);
            Assert.AreEqual(result.Count, 1);
            Assert.AreEqual(result.FirstOrDefault().NotificationId, notificationItems.FirstOrDefault().NotificationId);
            Assert.AreEqual(result.FirstOrDefault().Status, NotificationItemStatus.Queued);
        }
Пример #2
0
        public async Task ResendEmailNotificatoinByDateRangeTest_ValidInput_NoRecordFound()
        {
            IList <EmailNotificationItemEntity> notificationItems = null;

            _ = this.emailManager.Setup(x => x.GetEmailNotificationsByDateRangeAndStatus(It.IsAny <string>(), It.IsAny <DateTimeRange>(), It.IsAny <List <NotificationItemStatus> >())).ReturnsAsync(notificationItems);
            var classUnderTest = new EmailHandlerManager(this.configuration, this.msGraphSettingOptions.Object, this.cloudStorageClient.Object, this.logger.Object, this.emailManager.Object);
            var result         = await classUnderTest.ResendEmailNotificationsByDateRange(this.applicationName, this.dateRange);

            Assert.IsNull(result);

            notificationItems = new List <EmailNotificationItemEntity>();
            _ = this.emailManager.Setup(x => x.GetEmailNotificationsByDateRangeAndStatus(It.IsAny <string>(), It.IsAny <DateTimeRange>(), It.IsAny <List <NotificationItemStatus> >())).ReturnsAsync(notificationItems);
            classUnderTest = new EmailHandlerManager(this.configuration, this.msGraphSettingOptions.Object, this.cloudStorageClient.Object, this.logger.Object, this.emailManager.Object);
            result         = await classUnderTest.ResendEmailNotificationsByDateRange(this.applicationName, this.dateRange);

            Assert.IsNull(result);
        }