user216672
user216672

Reputation: 151

ChangePassword test

Ive been doing test only about 3 weeks now. I am trying to write a test for TestChangePassword. My problem is that Im stuck. I dont know what to call, or what to test. Can someone give an example and explain your example?

    [TestMethod]
    public void TestChangePassword()
    {
        try //Assert.AreEqual(password, "ABCDE");//Assert.AreEqual(oldPwd, "ABCDE");
        {
            AsaMembershipProvider prov = this.GetMembershipProvider();

            bool success = prov.ChangePassword("test.user", "test", "ABCDE");
            if (success)
            {
                // Change it back
                success = prov.ChangePassword("test.user", "ABCDE", "test");
            }


        }
        catch (Exception ex)
        {
            LogMessage(ex);
            Assert.Fail(ex.Message);
        }

    }

Upvotes: 0

Views: 104

Answers (1)

Matthew
Matthew

Reputation: 25763

Depending on exactly what you're trying to test, I would test that changing your password requires your authentication to use the new password. If your password has restrictions on it (length, complexity), you could test that as well.

Upvotes: 1

Related Questions