In this case I recommend split testing.
First, can write a test, which would test PasswordPolicy
or StrongPasswordAttribute
:
[Test]
public void PasswordPolicy_should_reject_short_passwords()
{
PasswordPolicy policy = new PasswordPolicy();
bool result = policy.Validate("pwd");
Assert.IsFalse(result);
}
Second, make sure that some property of model marked with StrongPasswordAttribute
attribute:
[Test]
public void Password_in_SomeModel_should_be_marked_StrongPasswordAttribute()
{
Type type = typeof(SomeModel);
bool hasAttribute = // use reflection here
Assert.IsTrue(hasAttribute)
}