Ejemplo n.º 1
0
        public void LoadTemplateReturnsData()
        {
            var testOptions = Options.Create <NoticeEmailOptions> (
                new NoticeEmailOptions
            {
                EmailTemplateFolder = @"c:\approot\emailTemplates"
            });

            string expected = testHtml;

            var cut    = new NoticeEmail(testOptions, null, null, fileSystem);
            var actual = cut.LoadTemplate("testtemplate.html");

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 2
0
        public void LoadTemplateThrowsExceptionWhenMessingTemplateFolderOption()
        {
            var testOptions = Options.Create <NoticeEmailOptions> (new NoticeEmailOptions());

            var  expected = typeof(EmailServiceException);
            Type actual   = null;

            try
            {
                var cut = new NoticeEmail(testOptions, null, null, fileSystem);
                cut.LoadTemplate("testfolder");
            }
            catch (Exception ex)
            {
                actual = ex.GetType();
            }
        }
Ejemplo n.º 3
0
        public void LoadTemplateThrowsOnBadTemplateFilename()
        {
            IOptions <NoticeEmailOptions> testOptions = Options.Create <NoticeEmailOptions> (
                new NoticeEmailOptions
            {
                EmailTemplateFolder = @"c:\approot\emailTemplates"
            });

            var  expected = typeof(EmailServiceException);
            Type actual   = null;

            try
            {
                var cut = new NoticeEmail(testOptions, null, null, fileSystem);
                cut.LoadTemplate("BadFile.html");
            }
            catch (Exception ex)
            {
                actual = ex.GetType();
            }
        }