コード例 #1
0
        public void GetForgotPasswordMailTemplateShouldNotThrowExceptionWhenSubjIsEmpty(Db db)
        {
            var fakeSite = BuildUpSiteContext(db, subj: null);

            using (new SiteContextSwitcher(fakeSite))
            {
                var settings = new AccountsSettingsService();
                settings.GetForgotPasswordMailTemplate().Subject.Should().BeEmpty();
            }
        }
コード例 #2
0
        public void GetForgotPasswordMailTemplateShouldRetreiveSubjectFromItem(Db db)
        {
            var fakeSite = BuildUpSiteContext(db);

            using (new SiteContextSwitcher(fakeSite))
            {
                var settings     = new AccountsSettingsService();
                var mailTemplate = settings.GetForgotPasswordMailTemplate();
                mailTemplate.Subject.Should().Be("restore password subject");
            }
        }
コード例 #3
0
        public void GetForgotPasswordMailTemplateShouldThrowExceptionWhenFromAddressIsEmpty(Db db)
        {
            var fakeSite = BuildUpSiteContext(db, @from: null);

            using (new SiteContextSwitcher(fakeSite))
            {
                var    settings = new AccountsSettingsService();
                Action act      = () => settings.GetForgotPasswordMailTemplate();
                act.ShouldThrow <InvalidValueException>().WithMessage("'From' field in mail template should be set");
            }
        }
コード例 #4
0
        public void GetForgotPasswordMailTemplateShouldRetreiveSourceAddressFromItem(Db db)
        {
            var fakeSite = BuildUpSiteContext(db);

            using (new SiteContextSwitcher(fakeSite))
            {
                var settings     = new AccountsSettingsService();
                var mailTemplate = settings.GetForgotPasswordMailTemplate();
                mailTemplate.From.Address.Should().Be("*****@*****.**");
            }
        }
コード例 #5
0
        public void GetForgotPasswordMailTemplateShouldThrowExceptionWhenMailTemplateNotfound(Db db)
        {
            var fakeSite = BuildUpSiteContext(db, @from: null);

            db.GetItem("/sitecore/content/siteroot").DeleteChildren();
            using (new SiteContextSwitcher(fakeSite))
            {
                var    settings = new AccountsSettingsService();
                Action act      = () => settings.GetForgotPasswordMailTemplate();
                act.ShouldThrow <ItemNotFoundException>();
            }
        }