Ejemplo n.º 1
0
        public void DoubleLoginTest()
        {
            if (TestInfrastructure.IsActive(TestContext))
            {
                switch (TestInfrastructure.ConnectionType(TestContext))
                {
                case "File":
                case "sqlce":
                    throw new DoubleLoginException();

                default:
                    break;
                }

                ConnectionStringStruct connectionString = TestInfrastructure.GetConnectionString(TestContext);
                LearnLogic             learnLogic       = new LearnLogic(OpenUserProfileTests.GetUserAdmin, (DataAccessErrorDelegate) delegate { return; });
                learnLogic.User.Authenticate((GetLoginInformation)MLifterTest.DAL.TestInfrastructure.GetTestUser,
                                             connectionString, (DataAccessErrorDelegate) delegate { return; });

                //Doesn't throw the Exception because the UserFactory logs out the previous user
                LearnLogic lLogic = new LearnLogic(OpenUserProfileTests.GetUserAdmin, (DataAccessErrorDelegate) delegate { return; });
                lLogic.User.Authenticate((GetLoginInformation)GetLoginErrorMethod, connectionString, (DataAccessErrorDelegate) delegate { return; });

                //Check instead if old user is logged out properly
                if (!learnLogic.UserSessionAlive)
                {
                    throw new DoubleLoginException();
                }
            }
            else
            {
                throw new DoubleLoginException();
            }
        }