public static void InitializeTestClass(TestContext context)
        {
            // Use the App.config to set the properties of the MongoDB database.
            mongoProvider = (MongoDBMembershipProvider)Membership.Provider;

            // Clean up common usernames used accross the different tests.
            foreach (string username in commonUsernamesUsedInTests)
            {
                MembershipUser user = mongoProvider.GetUser(username, false);

                if (user != null)
                {
                    mongoProvider.DeleteUser(username, true);
                }
            }
        }
Beispiel #2
0
        public static void InitializeTestClass(TestContext context)
        {
            // Use the App.config to set the properties of the MongoDB database.
            mongoProvider = (MongoDBMembershipProvider)Membership.Provider;



            // Clean up common usernames used accross the different tests.
            foreach (string username in commonUsernamesUsedInTests)
            {
                MembershipUser user = mongoProvider.GetUser(username, false);

                if (user != null)
                {
                    mongoProvider.DeleteUser(username, true);
                }
            }
        }
Beispiel #3
0
        public void CleanupTest()
        {
            foreach (string username in commonUsernamesUsedInTests)
            {
                MembershipUser user = mongoProvider.GetUser(username, false);

                if (user != null)
                {
                    mongoProvider.DeleteUser(username, true);
                }
            }
        }
Beispiel #4
0
        public void DeleteUserTest()
        {
            DateTime       startTest = DateTime.Now;
            bool           success;
            MembershipUser user;

            ///// Delete a user that does not exist ////////////////////////////////////////////////////////////
            user = mongoProvider.GetUser("unknownUser", false);
            Assert.IsNull(user, "Should not be able to retrieve this user");

            success = mongoProvider.DeleteUser("unknownUser", true);
            Assert.IsTrue(success, "By definition deleting a non existing user should succeed.");
            ///////////////////////////////////////////////////////////////////////////////////////////////////

            ///// Delete an existing user /////////////////////////////////////////////////////////////////////
            success = mongoProvider.DeleteUser("username1", true);
            Assert.IsTrue(success, "Should have been able to delete the user");

            user = mongoProvider.GetUser("username1", false);
            Assert.IsNull(user, "Should not be able to retrieve this user");
            ///// Delete an existing user /////////////////////////////////////////////////////////////////////


            ///// Delete an existing user with alternate casing ////////////////////////////////////////////////
            success = mongoProvider.DeleteUser("USERName2", true);
            Assert.IsTrue(success, "Should have been able to delete the user");

            user = mongoProvider.GetUser("username2", false);
            Assert.IsNull(user, "Should not be able to retrieve this user");

            user = mongoProvider.GetUser("username2", true);
            Assert.IsNull(user, "Should not be able to retrieve this user");

            user = mongoProvider.GetUser("USERName2", false);
            Assert.IsNull(user, "Should not be able to retrieve this user");

            user = mongoProvider.GetUser("USERName2", true);
            Assert.IsNull(user, "Should not be able to retrieve this user");

            ///// Delete an existing user /////////////////////////////////////////////////////////////////////



            double durationMiliseconds = DateTime.Now.Subtract(startTest).TotalMilliseconds;

            Console.WriteLine(String.Format("Test Duration: {0} miliseconds.", durationMiliseconds));
        }