Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions LanguageTagsTests/LanguageTagTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,8 @@ public void Equals_NullTag_ReturnsFalse()
{
LanguageTag tag = LanguageTag.Parse("en-US")!;
_ = tag.Equals(null).Should().BeFalse();
#pragma warning disable CS8602
_ = tag.Equals((object?)null).Should().BeFalse();
#pragma warning restore CS8602
// tag is non-null; ! avoids a CS8602 false-positive on the Equals(object?) receiver.
_ = tag!.Equals((object?)null).Should().BeFalse();
Comment thread
ptr727 marked this conversation as resolved.
}

[Fact]
Expand Down Expand Up @@ -282,14 +281,17 @@ public void OperatorEquals_DifferentTags_ReturnsFalse()
}

[Fact]
[System.Diagnostics.CodeAnalysis.SuppressMessage(
"Maintainability",
"CA1508:Avoid dead conditional code",
Justification = "Test intentionally compares two null tags to exercise operator== with both operands null."
)]
public void OperatorEquals_BothNull_ReturnsTrue()
{
LanguageTag? tag1 = null;
LanguageTag? tag2 = null;

#pragma warning disable CA1508 // Avoid dead conditional code
_ = (tag1 == tag2).Should().BeTrue();
#pragma warning restore CA1508
}

[Fact]
Expand Down