public void CreateUser() { MockUser mockUser = MockUser.CreateDefaultUser(); MockAuthentication provider = new MockAuthentication(); AuthenticationBaseTest.SetUserInProviders(mockUser); // GetUser(IIdentity) MockUser userGUM = provider.GetAuthenticatedUserMock(mockUser); Assert.IsTrue(provider.WasCreateUserInvoked, "CreateUser should have been invoked from GetUser(IIdentity)."); provider.WasCreateUserInvoked = false; // GetAnonymousUser MockUser userGAU = provider.GetAnonymousUserMock(); Assert.IsTrue(provider.WasCreateUserInvoked, "GetAnonymousUser should have been invoked from GetUser."); provider.WasGetAnonymousUserInvoked = false; Assert.IsNotNull(provider.CreateUserMock(), "User should not be null."); }
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); }