Skip to content

Conversation

@Evangelink
Copy link
Member

Fix #6137

Comment on lines +331 to +333
CurrentTestContextAsyncLocal.Value = testContext;
TestContext.SetCurrentContext(testContext);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's best to unify this so we have a single value and a single source of truth.

/// Sets the current <see cref="TestContext"/> for the async context.
/// </summary>
/// <param name="testContext">The test context to set, or <see langword="null"/> to clear.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels redundant.

@Evangelink
Copy link
Member Author

@Youssef1313 I was also wondering if we want to take this as an opportunity to introduce different types/interfaces for the various stages of the context? The idea being that we could offer different state based on the stage (e.g. after test runs, we know the result, after all tests of a class run we know all results...)

@Youssef1313
Copy link
Member

@Youssef1313 I was also wondering if we want to take this as an opportunity to introduce different types/interfaces for the various stages of the context? The idea being that we could offer different state based on the stage (e.g. after test runs, we know the result, after all tests of a class run we know all results...)

That seems like a much bigger piece of work. We definitely can do given some design proposal.

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.

Consider exposing TestContext.Current static property

3 participants