public void LoginSystemUserResultsInPricipalIdentityBeingSet() { ILoginCriteria user = CreateSystemUser(); IsolateGetIdentity(); GenFormPrincipal.Login(user); Assert.IsNotNull(GenFormPrincipal.GetPrincipal().Identity, "Principal identity should be set"); }
public void LoginWithAsSystemUserWithWrongPasswordShouldReturnFalse() { var user = (LoginCriteria)CreateSystemUser(); user.Password = "******"; GenFormPrincipal.Login(user); Assert.IsFalse(GenFormPrincipal.GetPrincipal().IsLoggedIn(), "System user should not be able to login with password bar"); }
public void Init() { _principal = Isolate.Fake.Instance <GenFormPrincipal>(); _identity = Isolate.Fake.Instance <IGenFormIdentity>(); Isolate.WhenCalled(() => _principal.Identity).WillReturn(_identity); Isolate.WhenCalled(() => GenFormPrincipal.GetPrincipal()).WillReturn(_principal); Isolate.WhenCalled(() => GenFormPrincipal.Login(_criteria)).IgnoreCall(); Isolate.WhenCalled(() => EnvironmentServices.SetEnvironment(string.Empty)).IgnoreCall(); _dto = GetAdminUserDto(); }
public static bool IsLoggedIn(string userName) { return(GenFormPrincipal.GetPrincipal().Identity.Name == userName && GenFormPrincipal.GetPrincipal().IsLoggedIn()); }
public void IsLoggedInReturnsFalseForAnonymousUser() { var principal = GenFormPrincipal.GetPrincipal(); Assert.IsFalse(principal.IsLoggedIn(), "Principal that is not logged in should return false"); }