Ejemplo n.º 1
0
        public async Task GetMeetingNotificationItemEntitiesTests()
        {
            IEnumerable <MeetingNotificationItemTableEntity> entities = new List <MeetingNotificationItemTableEntity> {
                new MeetingNotificationItemTableEntity {
                    NotificationId = "notificationId1"
                }, new MeetingNotificationItemTableEntity {
                    NotificationId = "notificationId2"
                }
            };
            IList <MeetingNotificationItemEntity> itemEntities = new List <MeetingNotificationItemEntity> {
                new MeetingNotificationItemEntity {
                    NotificationId = "notificationId1"
                }, new MeetingNotificationItemEntity {
                    NotificationId = "notificationId1"
                }
            };

            this.mailAttachmentRepository.Setup(x => x.DownloadMeetingInvite(It.IsAny <IList <MeetingNotificationItemEntity> >(), It.IsAny <string>())).Returns(Task.FromResult(itemEntities));
            var meetingHistoryTable = new Mock <CloudTable>(new Uri("http://unittests.localhost.com/FakeTable"), (TableClientConfiguration)null);

            _ = this.cloudStorageClient.Setup(x => x.GetCloudTable("MeetingHistory")).Returns(meetingHistoryTable.Object);
            _ = meetingHistoryTable.Setup(x => x.ExecuteQuery(It.IsAny <TableQuery <MeetingNotificationItemTableEntity> >(), It.IsAny <TableRequestOptions>(), It.IsAny <OperationContext>())).Returns(entities);
            IOptions <StorageAccountSetting> options = Options.Create <StorageAccountSetting>(new StorageAccountSetting {
                BlobContainerName = "Test", ConnectionString = "Test Con", MailTemplateTableName = "MailTemplate", EmailHistoryTableName = "EmailHistory", MeetingHistoryTableName = "MeetingHistory", NotificationQueueName = "test-queue"
            });
            var repo  = new TableStorageEmailRepository(options, this.cloudStorageClient.Object, this.logger.Object, this.mailAttachmentRepository.Object);
            var items = await repo.GetMeetingNotificationItemEntities(new List <string> {
                "notificationId1", "notificationId2"
            }, this.applicationName);

            Assert.IsTrue(items.Count == 2);
        }
Ejemplo n.º 2
0
        public async Task GetMeetingNotificationItemEntitiesTests()
        {
            IEnumerable <MeetingNotificationItemTableEntity> entities = new List <MeetingNotificationItemTableEntity> {
                new MeetingNotificationItemTableEntity {
                    NotificationId = "notificationId1"
                }, new MeetingNotificationItemTableEntity {
                    NotificationId = "notificationId2"
                }
            };
            IList <MeetingNotificationItemEntity> itemEntities = new List <MeetingNotificationItemEntity> {
                new MeetingNotificationItemEntity {
                    NotificationId = "notificationId1"
                }, new MeetingNotificationItemEntity {
                    NotificationId = "notificationId1"
                }
            };

            _ = this.mailAttachmentRepository.Setup(x => x.DownloadMeetingInvite(It.IsAny <IList <MeetingNotificationItemEntity> >(), It.IsAny <string>())).Returns(Task.FromResult(itemEntities));
            _ = this.meetingHistoryTable.Setup(x => x.ExecuteQuery(It.IsAny <TableQuery <MeetingNotificationItemTableEntity> >(), null, null)).Returns(entities);
            IOptions <StorageAccountSetting> options = Options.Create <StorageAccountSetting>(new StorageAccountSetting {
                BlobContainerName = "Test", ConnectionString = "Test Con", MailTemplateTableName = "MailTemplate"
            });
            var repo  = new TableStorageEmailRepository(options, this.cloudStorageClient.Object, this.logger.Object, this.mailAttachmentRepository.Object);
            var items = await repo.GetMeetingNotificationItemEntities(new List <string> {
                "notificationId1", "notificationId2"
            }, this.applicationName);

            Assert.IsTrue(items.Count == 2);
        }