public void GetAnonymousUser() { MockUser mockUser = MockUser.CreateDefaultUser(); MockAuthentication provider = new MockAuthentication(); AuthenticationBaseTest.SetUserInProviders(mockUser); // Logout MockUser userL = provider.Logout(); Assert.IsTrue(provider.WasGetAnonymousUserInvoked, "GetAnonymousUser should have been invoked from Logout."); provider.WasGetAnonymousUserInvoked = false; // GetUser MockUser userGU = provider.GetUser(); Assert.IsTrue(provider.WasGetAnonymousUserInvoked, "GetAnonymousUser should have been invoked from GetUser."); provider.WasGetAnonymousUserInvoked = false; // Logout should return the same value as GetAnonymousUser AuthenticationBaseTest.CompareUsers(mockUser, provider.GetAnonymousUserMock(), true); AuthenticationBaseTest.CompareUsers(mockUser, userL, true); AuthenticationBaseTest.CompareUsers(mockUser, userGU, true); }
public void Logout() { MockUser mockUser = MockUser.CreateDefaultUser(); MockAuthentication provider = new MockAuthentication(); AuthenticationBaseTest.SetUserInProviders(mockUser); MockUser user = provider.Logout(); AuthenticationBaseTest.CompareUsers(mockUser, user, true); }
public void ClearAuthenticationToken() { MockUser mockUser = MockUser.CreateDefaultUser(); MockAuthentication provider = new MockAuthentication(); // Failure AuthenticationBaseTest.SetUserInProviders(null); MockUser user = provider.Logout(); Assert.IsTrue(provider.WasClearAuthenticationTokenInvoked, "ClearAuthenticationToken should have been invoked from Logout."); }