Example #1
0
        public async Task SendEmail_NoUpdates_ReturnNull()
        {
            var user = new UpdateUserEmailDto()
            {
                UserId         = 0,
                UserName       = "******",
                Language       = new CultureInfo("he"),
                ToEmailAddress = "some email"
            };


            var asyncCollector = new TestAsyncCollector <SendGridMessage>();

            await EmailUpdateFunction.SendEmail(user,
                                                asyncCollector,
                                                _queryBusStub.Object,
                                                null,
                                                _dataProtectProviderStub.Object,
                                                _hostUriService.Object,
                                                CancellationToken.None);

            var message = asyncCollector.Result.FirstOrDefault();

            message.Should().BeNull();
        }
Example #2
0
        public async Task SendEmail_UserWithHebrew_EmailIsRtl()
        {
            var user = new UpdateUserEmailDto()
            {
                UserId         = 159039,
                UserName       = "******",
                Language       = new CultureInfo("he"),
                ToEmailAddress = "some email"
            };

            List <DocumentUpdateEmailDto> update = new List <DocumentUpdateEmailDto>();

            update.Add(new DocumentUpdateEmailDto()
            {
                Id        = 11,
                Name      = "Load Stress Testing Multimi2.docx",
                Course    = "Box Read for hotmail user",
                UserId    = 2641,
                UserName  = "******",
                UserImage = null,
            });

            _queryBusStub.Setup(s => s.QueryAsync(It.IsAny <GetUpdatesEmailByUserQuery>(), default)).ReturnsAsync(update);

            var asyncCollector = new TestAsyncCollector <SendGridMessage>();

            await EmailUpdateFunction.SendEmail(user,
                                                asyncCollector,
                                                _queryBusStub.Object,
                                                null,
                                                _dataProtectProviderStub.Object,
                                                _hostUriService.Object,
                                                CancellationToken.None);

            var message = asyncCollector.Result.First();

            var firstObject = message.Personalizations.First();
            var email       = (UpdateEmail)firstObject.TemplateData;

            message.TemplateId.Should().Be(EmailUpdateFunction.HebrewTemplateId);
            email.Direction.Should().Be("rtl");
        }