-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify HasCorrectTimeout #4042
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assigning @nohwnd for review
/// <summary> | ||
/// Gets a value indicating whether the instance has the correct test timeout signature. | ||
/// </summary> | ||
internal bool HasCorrectTimeout { get; private set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My personal preference here is to keep the constructors as they were before and switch this to:
internal bool HasCorrectTimeout { get; private set; } | |
internal bool HasCorrectTimeout => Timeout > 0; |
public void HasCorrectTimeoutShouldReturnFalseForMethodsWithInvalidTimeoutAttribute() | ||
{ | ||
MethodInfo methodInfo = typeof(DummyTestClass).GetMethod("PublicMethodWithInvalidTimeout"); | ||
Verify(!methodInfo.HasCorrectTimeout()); | ||
} | ||
|
||
public void HasCorrectTimeoutShouldReturnTrueForMethodsWithTimeoutAttribute() | ||
{ | ||
MethodInfo methodInfo = typeof(DummyTestClass).GetMethod("PublicMethodWithTimeout"); | ||
Verify(methodInfo.HasCorrectTimeout()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests should probably be replaced by:
public void HasCorrectTimeoutShouldReturnFalseForMethodsWithInvalidTimeoutAttribute()
{
var timeoutAttribute = new TimeoutAttribute(-11);
Verify(!timeoutAttribute.HasCorrectTimeout);
}
public void HasCorrectTimeoutShouldReturnTrueForMethodsWithTimeoutAttribute()
{
var timeoutAttribute = new TimeoutAttribute(11);
Verify(timeoutAttribute.HasCorrectTimeout);
}
Also, now PublicMethodWithInvalidTimeout
and PublicMethodWithTimeout
are unused I think
it was never called with a null value. so move it to a calculated property on the attribute