Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DiagnosticSuppressor for Nullable<T> #414

Closed
manfred-brands opened this issue Dec 14, 2021 · 1 comment · Fixed by #415
Closed

Add DiagnosticSuppressor for Nullable<T> #414

manfred-brands opened this issue Dec 14, 2021 · 1 comment · Fixed by #415
Assignees

Comments

@manfred-brands
Copy link
Member

Currently the following is not suppressed:

int? value = GetValue();
Assert.That(value.HasValue, Is.True);
Assert.That(value.Value, Is.EqualTo(42));

static int? GetValue() => 42;

We need to update to DiagnosticSuppressor to detected Nullable<T> and .HasValue

@manfred-brands
Copy link
Member Author

Workaround is:

int? value = GetValue();
Assert.That(value, Is.Not.Null);
Assert.That(value.Value, Is.EqualTo(42));

static int? GetValue() => 42;

@mikkelbu mikkelbu added this to the Release 3.3 / 2.3 milestone Dec 14, 2021
@manfred-brands manfred-brands changed the title At DiagnosticSuppressor for Nullable<T> Add DiagnosticSuppressor for Nullable<T> Dec 15, 2021
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 a pull request may close this issue.

2 participants