VerifyTests/Verify

[Feature request] Support MSTest without requiring VerifyBase base class

MattKotsenas opened this issue · 1 comments

Is the feature request related to a problem

Currently, MSTest support uses a VerifyBase base class that all tests must inherit from. This requirement can cause issues with other test tools that also use a base class for extensibility since tests can only have one base class.

From what I can tell, the only reason to need a base class specifically is to declare the TestContext property, which MSTest injects.

Describe the solution

The feature request is to support an alternative way of adding Verify support to MSTest classes that does not consume the base class.

One solution that seems workable to me would be to introduce an attribute such as [UsesVerify] paired with a source generator that adds the TestContext property to the class. The Verify() calls could then be supplied via a static using like they are for xunit.

Describe alternatives considered

Unsure of alternative solutions, but open to other ideas.

Additional context

I'm happy to do the work myself if you'd like, but I wanted to ask before starting in case a feature like this was already considered and rejected.

If you have any questions / concerns, please let me know. Thanks!

this would be awesome. happy to accept a PR for this