public void ChangePasswordTest2()
        {
            FelBookDBEntities  db = new FelBookDBEntities();
            IMembershipService MembershipService = new FelbookAccountMembershipService(db);
            bool result;

            // záloha badUser

            result = MembershipService.ChangePassword("badUser", "old password", "new password");
            Assert.IsFalse(result);

            // případné obnovení badUser

            // vytvoření someUser s goodPassword
            User user = User.CreateUser(0, "Ota", "Sandr",
                                        DateTime.Now, "mail", "someUser", "");

            user.ChangePassword("goodPassword");
            db.UserSet.AddObject(user);
            db.SaveChanges();

            result = MembershipService.ChangePassword("someUser", "bad password", "new password");
            Assert.IsFalse(result);

            result = MembershipService.ChangePassword("someUser", "goodPassword", "new password");
            Assert.IsTrue(result);

            // odstranění someUser
            db.UserSet.DeleteObject(user);
            db.SaveChanges();
        }
        public void ChangePasswordTest1()
        {
            FelBookDBEntities  db = new FelBookDBEntities();
            IMembershipService MembershipService = new FelbookAccountMembershipService(db);

            #region usernameTests
            try
            {
                MembershipService.ChangePassword(null, "old password", "new password");
            }
            catch (ArgumentException ex)
            {
                Assert.AreEqual("Value cannot be null or empty." + Environment.NewLine + "Parameter name: userName", ex.Message);
            }

            try
            {
                MembershipService.ChangePassword("", "old password", "new password");
            }
            catch (ArgumentException ex)
            {
                Assert.AreEqual("Value cannot be null or empty." + Environment.NewLine + "Parameter name: userName", ex.Message);
            }
            #endregion

            #region oldPasswordTests
            try
            {
                MembershipService.ChangePassword("some username", null, "new password");
            }
            catch (ArgumentException ex)
            {
                Assert.AreEqual("Value cannot be null or empty." + Environment.NewLine + "Parameter name: oldPassword", ex.Message);
            }

            try
            {
                MembershipService.ChangePassword("some username", "", "new password");
            }
            catch (ArgumentException ex)
            {
                Assert.AreEqual("Value cannot be null or empty." + Environment.NewLine + "Parameter name: oldPassword", ex.Message);
            }
            #endregion

            #region newPasswordTests
            try
            {
                MembershipService.ChangePassword("some username", "old password", null);
            }
            catch (ArgumentException ex)
            {
                Assert.AreEqual("Value cannot be null or empty." + Environment.NewLine + "Parameter name: newPassword", ex.Message);
            }

            try
            {
                MembershipService.ChangePassword("some username", "old password", "");
            }
            catch (ArgumentException ex)
            {
                Assert.AreEqual("Value cannot be null or empty." + Environment.NewLine + "Parameter name: newPassword", ex.Message);
            }
            #endregion

            try
            {
                MembershipService.ChangePassword("some username", "old password", "new password");
            }
            catch (ArgumentException)
            {
                Assert.Fail();
            }
        }