Skip to content

[Feature]: MSTest WorkerAwareTest.TestContext should be virtual #3209

@MattKotsenas

Description

@MattKotsenas

🚀 Feature Request

In the MSTest harness, WorkerAwareTest has a TestContext property, see

public TestContext TestContext { get; set; } = null!;
. This property should be marked virtual so that it can be overridden by inheritors as necessary.

Example

No response

Motivation

Verify relies on hooking into TestContext to provide snapshot testing. It does this with a source generator to override the TestContext property and storing the property in its own AsyncLocal during set.

However, because WorkerAwareTest.TestContext isn't marked virtual, the source generator isn't able to add the setter hook. See VerifyTests/Verify#1482 for the bug on the Verify side as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions