Beispiel #1
0
        public async void LoadTestTemplateByEnam()
        {
            // preset
            var template = EmailTemplates.TestEmail;
            var expected = "<b>This is {test}</b>";
            // act
            string actual = await TemplateResolver.LoadTemplateAsync(template);

            // test
            Assert.Equal(expected, actual);
        }
Beispiel #2
0
        public async Task SendEmailAsync(EmailTemplates emailTemplate,
                                         Dictionary <string, string> templateReplace,
                                         string subject,
                                         string address,
                                         string name = "")
        {
            string htmlText = await TemplateResolver.LoadTemplateAsync(emailTemplate, templateReplace);

            string altText = StripHTML(htmlText);

            SetSubject(subject);
            SetHTML(htmlText, altText);
            AddAddressees(name, address);
            await SendEmailAsync();
        }
Beispiel #3
0
        public async void ReplaceTemplateKeysByDictionary()
        {
            // preset
            var template      = EmailTemplates.TestEmail;
            var expected      = "<b>This is bar</b>";
            var keyValuePairs = new Dictionary <string, string>
            {
                { "{test}", "bar" }
            };
            // act
            string actual = await TemplateResolver.LoadTemplateAsync(template, keyValuePairs);

            // test
            Assert.Equal(expected, actual);
        }
Beispiel #4
0
 protected async void LoadTemplate(EmailTemplates template, Dictionary <string, string> keyValuePairs)
 {
     await TemplateResolver.LoadTemplateAsync(template, keyValuePairs).ConfigureAwait(false);
 }