Skip to content

Assert(..., Is.EqualTo(...)) issues since 4.3.0 #4898

@moshekar

Description

@moshekar

After updating NUnit from 4.2.2 to 4.3.0, assertions of Is.EqualTo() are failing when the expected argument is not a string.
From what I see, the compiler selects the EqualTo(string? expected) overload.

For example, RedisValue is a struct, but the compiler still selects the string? version.
This causes Assert.That(redisResult, Is.EqualTo(RedisValue.Null) to fail even if redisResult == RedisValue.Null.

I could overcome this only by casting to object?: Assert.That(redisResult, Is.EqualTo((object?)RedisValue.Null)

Also I noticed headers (StringValues) comparisons now fail for assertions that succeeded before.

Using latest .net 9 with latest NUnit.

Thanks.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions