-
Notifications
You must be signed in to change notification settings - Fork 508
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
Make CancellationToken optional from tests #2877
Conversation
Since `CancellationToken.None` is equivalent to `default(CancellationToken)` according to https://github.com/dotnet/corefx/issues/495#issuecomment-72322134, and since the latter can further be shortened to just `default`, make use of both to cleanup a bunch of method calls that all ended up using just `CancellationToken.None`.
This is currently a style matter for this repository, along with the use of |
It's possible this style changes in the future, but at this time I'm not ready to apply it. If it changes, the cancellation token would be omitted from signatures altogether as opposed to making it optional. |
Hm... the reason for not wanting to make it optional, however, has nothing to do with what I submitted here, since the optional cancellation made optional is not in any test-defining method. |
I know this is just a matter of taste, but lines were already long enough that I was scrolling just to find out that it was all just |
In any case, getting a PR rejected in 3' after all that regex-fu, is a bit discouraging... Anyway, on to what I was really doing now... ¯\(ツ)/¯ |
Yeah, I knew that was going to be the case, but I figured it was better to close it early than leave it sitting here to never go anywhere. |
What about your comment that you didn't want it because of the issue with discovering/instantiating/invoking/whatever unit tests when optional parameters where part of the signature? Which is clearly different to what this PR does? The xunit/xunit#345 issue isn't implemented and even if it were, this PR doesn't prevent a specific test to provide a cancellation if needed/wanted, there's just a default in case you don't care, which is currently the case in all the removed code. So, it just removes all the useless boilerplate all over that's currently not adding any value... So I fail to see how it limits any such future feature. |
Since
CancellationToken.None
is equivalent todefault(CancellationToken)
according to https://github.com/dotnet/corefx/issues/495#issuecomment-72322134,
and since the latter can further be shortened to just
default
, make use ofboth to cleanup a bunch of method calls that all ended up using just
CancellationToken.None
.