<PackageReference Include="NUnit" Version="3.10.1" />

TupleComparerBase

Base class for comparators for tuples (both regular Tuples and ValueTuples).
using NUnit.Compatibility; using System; namespace NUnit.Framework.Constraints.Comparers { internal abstract class TupleComparerBase : IChainComparer { private readonly NUnitEqualityComparer _equalityComparer; internal TupleComparerBase(NUnitEqualityComparer equalityComparer) { _equalityComparer = equalityComparer; } protected abstract bool IsCorrectType(Type type); protected abstract object GetValue(Type type, string propertyName, object obj); public bool? Equal(object x, object y, ref Tolerance tolerance, bool topLevelComparison = true) { Type type = x.GetType(); Type type2 = y.GetType(); if (!IsCorrectType(type) || !IsCorrectType(type2)) return null; int num = TypeExtensions.GetGenericArguments(type).Length; if (num != TypeExtensions.GetGenericArguments(type2).Length) return false; for (int i = 0; i < num; i++) { string propertyName = (i < 7) ? ("Item" + (i + 1)) : "Rest"; object value = GetValue(type, propertyName, x); object value2 = GetValue(type2, propertyName, y); if (!_equalityComparer.AreEqual(value, value2, ref tolerance, false)) return false; } return true; } } }