-
Notifications
You must be signed in to change notification settings - Fork 291
MSTest v4 TestContext properties should not be nullable #1403
Copy link
Copy link
Labels
Area: MSTestIssues with MSTest that are not specific to more refined area (e.g. analyzers or assertions)Issues with MSTest that are not specific to more refined area (e.g. analyzers or assertions)Breaking ‼️In-PR
Milestone
Description
Describe the bug
MSTest 3.0.0-preview-20221122-01
TestContext.TestName is nullable, which is technically correct, but makes no sense to me.
Expected behavior
"All" (those which make sense) Properties of TestContext should not be nullable and throw an exception if the underlying property dictionary has those properties removed or replaced by nulls.
Example:
public virtual string TestName => GetProperty<string>("TestName") ?? throw new InvalidOperationException("Missing TestName");
Having nullable on all those properties just makes tests much more verbose. And when I expect a TestRunDirectory, havin null there is an exceptional case anyway. Plus if I really needed an optional TestRunDirectory I could retrieve it via GetProperty().
Actual behavior
| public virtual string? TestName => GetProperty<string>("TestName"); |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area: MSTestIssues with MSTest that are not specific to more refined area (e.g. analyzers or assertions)Issues with MSTest that are not specific to more refined area (e.g. analyzers or assertions)Breaking ‼️In-PR