Login() private méthode

private Login ( ) : System.Web.Mvc.ActionResult
Résultat System.Web.Mvc.ActionResult
 public void ShouldAddErrorToModelStateIfNotLoggedIn([Frozen] IAccountRepository repo, LoginInfo info, INotificationService service, IAccountsSettingsService accountSetting)
 {
   repo.Login(string.Empty, string.Empty).ReturnsForAnyArgs(x => false);
   var controller = new AccountsController(repo, service, accountSetting, null, null);
   var result = controller.Login(info);
   controller.ModelState.IsValid.Should().BeFalse();
   controller.ModelState.Keys.Should().Contain("invalidCredentials");
 }
 public void LoginShouldReturnViewModelIfModelStateNotValid([Frozen] IAccountRepository repo, LoginInfo info, INotificationService service, IAccountsSettingsService accountSetting)
 {
   var controller = new AccountsController(repo, service, accountSetting, null, null);
   controller.ModelState.AddModelError("Error", "Error");
   var result = controller.Login(info);
   result.Should().BeOfType<ViewResult>();
 }
    public void LoginShouldAddModelStateErrorIfNotLoggedIn(Database db, [Content] DbItem item, [Frozen] IAccountRepository repo, LoginInfo info, INotificationService service, [Frozen] IAccountsSettingsService accountSetting)
    {
      accountSetting.GetPageLinkOrDefault(Arg.Any<Item>(), Arg.Any<ID>(), Arg.Any<Item>()).Returns("/");
      var fakeSite = new FakeSiteContext(new StringDictionary
      {
        {
          "rootPath", "/sitecore/content"
        },
        {
          "startItem", item.Name
        }
      }) as SiteContext;
      fakeSite.Database = db;
      Language.Current = Language.Invariant;

      using (new SiteContextSwitcher(fakeSite))
      {
        info.ReturnUrl = null;
        info.Email = null;
        info.Password = null;
        var controller = new AccountsController(repo, service, accountSetting, null, null);
        repo.Login(string.Empty, string.Empty).ReturnsForAnyArgs(x => true);
        var result = controller.Login(info);
        result.Should().BeOfType<RedirectResult>().Which.Url.Should().Be("/");
      }
    }
 public void LoginShouldRedirectToReturnUrlIfLoggedIn([Frozen] IAccountRepository repo, LoginInfo info, INotificationService service, IAccountsSettingsService accountSetting)
 {
   var controller = new AccountsController(repo, service, accountSetting, null, null);
   repo.Login(string.Empty, string.Empty).ReturnsForAnyArgs(x => true);
   var result = controller.Login(info);
   result.Should().BeOfType<RedirectResult>().Which.Url.Should().Be(info.ReturnUrl);
 }
        public void Login_ReturnUrlNotSet_ShouldRedirectToRoot(Database db, [Content] DbItem item, User user, [Frozen] IAccountRepository repo, IUserProfileService userProfileService, LoginInfo info, INotificationService service, IAccountsSettingsService accountSetting)
        {
            accountSetting.GetPageLinkOrDefault(Arg.Any<Item>(), Arg.Any<ID>(), Arg.Any<Item>()).Returns("/");
            userProfileService.ValidateUser(Arg.Any<User>()).ReturnsForAnyArgs(true);
            var fakeSite = new FakeSiteContext(new StringDictionary
                                               {
                                                   {"rootPath", "/sitecore/content"},
                                                   {"startItem", item.Name}
                                               }) as SiteContext;
            fakeSite.Database = db;
            Language.Current = Language.Invariant;

            using (new SiteContextSwitcher(fakeSite))
            {
                info.ReturnUrl = null;
                var controller = new AccountsController(repo, service, accountSetting, userProfileService, null);
                repo.Login(string.Empty, string.Empty).ReturnsForAnyArgs(x => user);
                var result = controller.Login(info);
                result.Should().BeOfType<RedirectResult>().Which.Url.Should().Be("/");
            }
        }
 public void Login_ValidaData_ShouldRedirectToReturnUrl([Frozen] IAccountRepository repo, LoginInfo info, User user, INotificationService service, IAccountsSettingsService accountSetting, IUserProfileService userProfileService)
 {
     userProfileService.ValidateUser(Arg.Any<User>()).ReturnsForAnyArgs(true);
     var controller = new AccountsController(repo, service, accountSetting, userProfileService, null);
     repo.Login(string.Empty, string.Empty).ReturnsForAnyArgs(x => user);
     var result = controller.Login(info);
     result.Should().BeOfType<RedirectResult>().Which.Url.Should().Be(info.ReturnUrl);
 }