Login() public method

public Login ( string userName, string password ) : User
userName string
password string
return User
Ejemplo n.º 1
0
    public void Login_NotLoggedInUser_ShouldNotTrackLoginEvents(FakeMembershipUser user, [Frozen]IAccountTrackerService accountTrackerService, AuthenticationProvider authenticationProvider, AccountRepository repo)
    {
      authenticationProvider.Login(@"somedomain\John", Arg.Any<string>(), Arg.Any<bool>()).Returns(false);

      var context = new FakeSiteContext(new StringDictionary
      {
        {
          "domain", "somedomain"
        }
      });
      using (new Switcher<Domain, Domain>(new Domain("somedomain")))
      {
        using (new AuthenticationSwitcher(authenticationProvider))
        {
          var loginResult = repo.Login("John", "somepassword");
          accountTrackerService.DidNotReceive().TrackLogin(Arg.Any<string>());
        }
      }
    }
Ejemplo n.º 2
0
    public void LoginShouldReturnFalseIfUserIsNotLoggedIn(FakeMembershipUser user, AuthenticationProvider authenticationProvider, AccountRepository repo)
    {
      authenticationProvider.Login(@"somedomain\John", Arg.Any<string>(), Arg.Any<bool>()).Returns(false);

      var context = new FakeSiteContext(new StringDictionary
      {
        {
          "domain", "somedomain"
        }
      });
      using (new Switcher<Domain, Domain>(new Domain("somedomain")))
      {
        using (new AuthenticationSwitcher(authenticationProvider))
        {
          var loginResult = repo.Login("John", "somepassword");
          loginResult.Should().BeFalse();
        }
      }
    }