public async Task QueueMeetingNotificationsTests()
        {
            var items = new List <MeetingNotificationItemEntity> {
                new MeetingNotificationItemEntity {
                    Application = "TestApp", RequiredAttendees = "*****@*****.**"
                }
            };

            _ = this.mockedEmailManager.Setup(x => x.CreateMeetingNotificationEntities("TestApp", It.IsAny <MeetingNotificationItem[]>(), NotificationService.Contracts.NotificationItemStatus.Queued)).ReturnsAsync(items);
            _ = this.mockedEmailManager.Setup(x => x.NotificationEntitiesToResponse(new List <NotificationResponse>(), It.Is <List <MeetingNotificationItemEntity> >(y => y.Any(c => c.Application == "TestApp")))).Returns(new List <NotificationResponse> {
                new NotificationResponse {
                    NotificationId = "notificationId1"
                }
            });
            var emailHandler             = new EmailHandlerManager(this.Configuration, this.msGraphSettings, this.mockedCloudStorageClient.Object, this.Logger, this.mockedEmailManager.Object);
            var meetingNotificationItems = new List <MeetingNotificationItem> {
                new MeetingNotificationItem {
                    RequiredAttendees = "*****@*****.**"
                }
            };
            var response = await emailHandler.QueueMeetingNotifications("TestApp", meetingNotificationItems.ToArray());

            Assert.IsNotNull(response);
            Assert.IsTrue(response.Count == 1);
            Assert.IsTrue(response[0].NotificationId == "notificationId1");
        }
Пример #2
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);
        }
Пример #3
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);
        }