public async Task SaveNotificationMessages_SaveMessage()
        {
            //Arrange
            var id       = Guid.NewGuid().ToString();
            var messages = new List <EmailNotificationMessage>
            {
                new EmailNotificationMessage()
                {
                    Id               = id,
                    NotificationId   = Guid.NewGuid().ToString(),
                    NotificationType = nameof(RegistrationEmailNotification),
                    From             = "*****@*****.**",
                    To               = "*****@*****.**",
                    Subject          = "subj",
                    Body             = "body"
                }
            };
            var messageEntity = new EmailNotificationMessageEntity()
            {
                Id = id, NotificationType = nameof(EmailNotificationMessage)
            };
            var messageEntities = new List <NotificationMessageEntity> {
                messageEntity
            };

            _repositoryMock.Setup(n => n.GetMessagesByIdsAsync(new[] { id })).ReturnsAsync(messageEntities.ToArray());

            //Act
            await _notificationMessageService.SaveNotificationMessagesAsync(messages.ToArray());
        }
Esempio n. 2
0
        public async Task SaveNotificationMessages_SaveMessage()
        {
            //Arrange
            string id       = Guid.NewGuid().ToString();
            var    messages = new List <EmailNotificationMessage>
            {
                new EmailNotificationMessage()
                {
                    Id               = id,
                    NotificationId   = Guid.NewGuid().ToString(),
                    NotificationType = nameof(EmailNotification)
                }
            };
            var messageEntity = new NotificationMessageEntity()
            {
                Id = id, NotificationType = nameof(EmailNotificationMessage)
            };
            var messageEntities = new List <NotificationMessageEntity> {
                messageEntity
            };

            _repositoryMock.Setup(n => n.GetMessageByIdAsync(new[] { id })).ReturnsAsync(messageEntities.ToArray());

            //Act
            await _notificationMessageService.SaveNotificationMessagesAsync(messages.ToArray());
        }