Skip to content

[Bug]: IgnoringType is ignored if type is in a ValueType #4320

@davidmehren

Description

@davidmehren

Description

When a type is stored inside a ValueType, like a tuple, it is not ignored when checking structural equivalency (IsEquivalentTo), when it has explicitly been excluded via IgnoringType.

This has been caused by #4263

Expected Behavior

Types that are specified in IgnoringType are ignored, even when they are stored in a ValueType.

Actual Behavior

Equivalency for these types is checked and tests unexpectedly fail.

Steps to Reproduce

See my reproducer at https://github.com/davidmehren/TUnitIgnoreTypeRepro/blob/main/Tests.cs

I would expect both tests to succeed.

TUnit Version

1.9.85

.NET Version

.NET 10.0.101

Operating System

Linux

IDE / Test Runner

dotnet CLI (dotnet test / dotnet run)

Error Output / Stack Trace

████████╗██╗   ██╗███╗   ██╗██╗████████╗
╚══██╔══╝██║   ██║████╗  ██║██║╚══██╔══╝
   ██║   ██║   ██║██╔██╗ ██║██║   ██║
   ██║   ██║   ██║██║╚██╗██║██║   ██║
   ██║   ╚██████╔╝██║ ╚████║██║   ██║
   ╚═╝    ╚═════╝ ╚═╝  ╚═══╝╚═╝   ╚═╝

   TUnit v1.9.85.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 (18ms)
  TUnit.Engine.Exceptions.TestFailedException: AssertionException: Expected actual to be equivalent to expected
  but Property Ignores did not match
  Expected: (IgnoreMe { Message = baz }, IgnoreMe { Message = baz })
  Received: (IgnoreMe { Message = foobar }, IgnoreMe { Message = foobar })
  
  at Assert.That(actual).IsEquivalentTo(expected).IgnoringType<IgnoreMe>()

Testlaufzusammenfassung: Fehler! - TUnitIgnoreTypeRepro.dll (net10.0|x64)
  gesamt: 2
  fehlerhaft: 1
  erfolgreich: 1
  übersprungen: 0
  Dauer: 267ms


Process finished with exit code 2.

Additional Context

No response

IDE-Specific Issue?

  • I've confirmed this issue occurs when running via dotnet test or dotnet run, not just in my IDE

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions