Refactor Tests using Dispose() Pattern in TastExecution Tests#13584
Merged
AlesProkop merged 5 commits intodotnet:mainfrom Apr 23, 2026
Merged
Refactor Tests using Dispose() Pattern in TastExecution Tests#13584AlesProkop merged 5 commits intodotnet:mainfrom
AlesProkop merged 5 commits intodotnet:mainfrom
Conversation
AR-May
approved these changes
Apr 22, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates TaskExecutionHost_Tests to avoid calling Dispose() as part of test setup, aligning the tests with more typical xUnit lifecycle patterns and the intent of issue #210.
Changes:
- Removed the
InitializeHost(bool throwOnExecute)setup variant and instead tweaks the task instance directly for the “execute throws” case. - Reworked task resolution failure tests to use locally-scoped
TaskExecutionHostinstances (using var host) instead of disposing/recreating the shared_host. - Added a
System.Threading.Tasksusing (currently unused).
JanProvaznik
approved these changes
Apr 22, 2026
Member
There was a problem hiding this comment.
makes sense, please think about the naming of the PR so it clearly describes what it does, when looking at git history this does not sound very descriptive.
simple draft from me would be:
"Refactor Dispose pattern in TaskExecutionHost Tests"
(btw you can edit PR descriptions that any time)
Contributor
jankratochvilcz
left a comment
There was a problem hiding this comment.
Can you help me with the reasoning of still having the duplicate InitializeHost? I may be missing some nuance
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
jankratochvilcz
approved these changes
Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #210
Context
Some of the tests currently contain Dispose() in the setup which is not necessary and tears down the host before building a new one with limited changed fields.
Changes Made
###TaskExecutionHost_Tests.cs
Restructured tests to not contain dispose() by using local variables or changing the required fields that were demanded by the test and differed from the common setup of the testing suite.
Testing
Ran the changed test.