public void GetForgotPasswordMailTemplateShouldNotThrowExceptionWhenSubjIsEmpty(Db db)
 {
   var fakeSite = BuildUpSiteContext(db, subj: null);
   using (new SiteContextSwitcher(fakeSite))
   {
     var settings = new AccountsSettingsService();
     settings.GetForgotPasswordMailTemplate().Subject.Should().BeEmpty();
   }
 }
 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");
   }
 }
 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");
   }
 }
 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("*****@*****.**");
   }
 }
 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>();
   }
 }
 public void GetRegisterOutcome_SettingsExist_ShouldReturnOutcomeID(Db db, ID outcomeId, AccountsSettingsService accountsSettingsService)
 {
   //Arrange
   var fakeSite = BuildUpSiteContext(db, outcomeID: outcomeId);
   using (new SiteContextSwitcher(fakeSite))
   {
     //Act
     var resultOutcomeId = accountsSettingsService.GetRegistrationOutcome(null);
     //Assert
     resultOutcomeId.Should().Be(outcomeId);
   }
 }
 public void GetRegisterOutcome_NullSettingsItem_ShouldthrowException(Db db, AccountsSettingsService accountsSettingsService)
 {
   //Arrange
   var fakeSite = BuildUpSiteContext(db, null);
   db.GetItem("/sitecore/content").DeleteChildren();
   using (new SiteContextSwitcher(fakeSite))
   {
     //Act
     //Assert
     accountsSettingsService.Invoking(x=>x.GetRegistrationOutcome(null)).ShouldThrow<ItemNotFoundException>();
   }
 }
 public void GetPageLinkOrDefaultShouldThrowIfDefaultIsNull(Item item, ID id, AccountsSettingsService accountSettingsService)
 {
   accountSettingsService.Invoking(x => x.GetPageLinkOrDefault(item, id, null)).ShouldThrow<ArgumentNullException>();
 }
 public void GetPageLinkOrDefaultShouldReturnPageNotFoundUrlIfDefaultIsNull(Item item, ID id, AccountsSettingsService accountSettingsService)
 {
   var result = accountSettingsService.GetPageLinkOrDefault(item, id, null);
   result.Should().Be(AccountsSettingsService.PageNotFoundUrl);
 }