Skip to content
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

Adding cancellation token support. #147

Merged
merged 1 commit into from
May 31, 2022

Conversation

Keboo
Copy link
Collaborator

@Keboo Keboo commented May 3, 2022

There are a few changes here:

  1. This adds a new resolver to automatically handle CancellationToken. Defaults to CancellationToken.None, but will use injected tokens or CancellationTokenSources to resolve if they are present.
  2. This drops the class generic constraint from the AutoMocker.Get methods. This was initially in place because there is a class constraint on Moq.Mock, however with resolvers it is perfectly valid to want to retrieve value types (such as CancellationToken).
  3. The source generator was updated to not generate argument null tests for value types.

There are a few changes here:
1. This adds a new resolver to automatically handle CancellationToken. Defaults to CancellationToken.None, but will use injected tokens or CancellationTokenSources to resolve if they are present.
2. This drops the class generic constraint from the AutoMocker.Get<T>  methods. This was initially in place because there is a class constraint on Moq.Mock<T>, however with resolvers it is perfectly valid to want to retrieve value types (such as CancellationToken).
3. The source generator was updated to not generate argument null tests for value types.
@Keboo Keboo requested a review from adamhewitt627 May 3, 2022 18:50
@adamhewitt627 adamhewitt627 merged commit 68aa0db into moq:master May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants