-
-
Notifications
You must be signed in to change notification settings - Fork 111
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
Value Types like ValueTuple are compared using Equals during IsEquivalentTo, which is incorrect, as these can contain objects that contain references.
Expected Behavior
Tuples that contain structurally equal objects are asserted as equal, even when they contain non-record reference types.
Actual Behavior
Tuples that contain structurally equal objects are asserted as non-equal
Steps to Reproduce
See reproducer at https://github.com/davidmehren/TUnitIgnoreTypeRepro/blob/broken-equivalence/Tests.cs
Thing.Numbers is a non-record reference type inside a record and needs to be compared structurally.
TUnit Version
1.10.0
.NET Version
.NET 10.0.1
Operating System
Linux
IDE / Test Runner
dotnet CLI (dotnet test / dotnet run)
Error Output / Stack Trace
████████╗██╗ ██╗███╗ ██╗██╗████████╗
╚══██╔══╝██║ ██║████╗ ██║██║╚══██╔══╝
██║ ██║ ██║██╔██╗ ██║██║ ██║
██║ ██║ ██║██║╚██╗██║██║ ██║
██║ ╚██████╔╝██║ ╚████║██║ ██║
╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝
TUnit v1.10.0.0 | 64-bit | Fedora Linux 43 (Workstation Edition) | linux-x64 | .NET 10.0.1 | Microsoft Testing Platform v2.0.2
Engine Mode: SourceGenerated
fehlerhaft Fails (24ms)
TUnit.Engine.Exceptions.TestFailedException: AssertionException: Expected (foo, bar to be equivalent to (bar, foo)
but Property did not match
Expected: (Thing { Name = Foo, Numbers = System.Int32[] }, Thing { Name = Foo, Numbers = System.Int32[] })
Received: (Thing { Name = Foo, Numbers = System.Int32[] }, Thing { Name = Foo, Numbers = System.Int32[] })
at Assert.That((foo, bar)).IsEquivalentTo((bar, foo))
Testlaufzusammenfassung: Fehler! - bin/Debug/net10.0/TUnitIgnoreTypeRepro.dll (net10.0|x64)
gesamt: 1
fehlerhaft: 1
erfolgreich: 0
übersprungen: 0
Dauer: 186msAdditional Context
No response
IDE-Specific Issue?
- I've confirmed this issue occurs when running via
dotnet testordotnet run, not just in my IDE
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working