<PackageReference Include="NUnit" Version="4.4.0-beta.2.1" />

EqualConstraint<T>

public class EqualConstraint<T> : EqualConstraint
EqualConstraint is able to compare an actual value with the expected value provided in its constructor. Two objects are considered equal if both are null, or if both have the same value. NUnit has special semantics for some object types.
using System; using System.Runtime.CompilerServices; namespace NUnit.Framework.Constraints { [NullableContext(1)] [Nullable(0)] public class EqualConstraint<[Nullable(2)] T> : EqualConstraint { [NullableContext(2)] public EqualConstraint(object expected) : base(expected) { } public EqualConstraint UsingPropertiesComparer(Func<PropertiesComparerConfiguration<T>, PropertiesComparerConfiguration<T>> configure) { base.Comparer.CompareProperties = true; base.Comparer.ComparePropertiesConfiguration = configure(new PropertiesComparerConfiguration<T>()); return this; } public override EqualConstraint UsingPropertiesComparer<[Nullable(2)] TParam>(Func<PropertiesComparerConfiguration<TParam>, PropertiesComparerConfiguration<TParam>> configure) { if (typeof(TParam) != typeof(T)) { DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(74, 2); defaultInterpolatedStringHandler.AppendLiteral("The type parameter "); defaultInterpolatedStringHandler.AppendFormatted(typeof(TParam).Name); defaultInterpolatedStringHandler.AppendLiteral(" does not match the type parameter "); defaultInterpolatedStringHandler.AppendFormatted(typeof(T).Name); defaultInterpolatedStringHandler.AppendLiteral(" of this constraint."); throw new ArgumentException(defaultInterpolatedStringHandler.ToStringAndClear(), "configure"); } base.Comparer.CompareProperties = true; base.Comparer.ComparePropertiesConfiguration = configure(new PropertiesComparerConfiguration<TParam>()); return this; } } }