Exemplo n.º 1
0
        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);
        }