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

PropertiesComparerConfiguration

Class to configure how to compare properties
using System; using System.Collections.Generic; using System.Runtime.CompilerServices; namespace NUnit.Framework.Constraints { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] public class PropertiesComparerConfiguration { internal static PropertiesComparerConfiguration Default { get; } = new PropertiesComparerConfiguration(); internal bool AllowComparingDifferentTypes { get; set; } internal bool OnlyCompareCommonProperties { get; set; } [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] [field: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] internal HashSet<string> PropertyNamesToExclude { [return: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] get; [param: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] set; } [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1, 1 })] [field: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1, 1 })] internal Dictionary<Type, HashSet<string>> PropertyNamesToExcludeForType { [return: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1, 1 })] get; [param: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1, 1 })] set; } [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] [field: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] internal HashSet<string> PropertyNamesToUse { [return: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] get; [param: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1 })] set; } [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1, 1 })] [field: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1, 1 })] internal Dictionary<Type, HashSet<string>> PropertyNamesToUseForType { [return: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1, 1 })] get; [param: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1, 1 })] set; } [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1 })] [field: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1 })] internal Dictionary<string, string> PropertyNameMap { [return: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1 })] get; [param: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1 })] set; } [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1, 1, 1 })] [field: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1, 1, 1 })] internal Dictionary<Type, Dictionary<string, string>> PropertyNameMapForType { [return: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1, 1, 1 })] get; [param: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1, 1, 1 })] set; } [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1, 1, 2 })] [field: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1, 1, 2 })] internal Dictionary<Type, Dictionary<string, object>> PropertyNameToValueMapForType { [return: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1, 1, 2 })] get; [param: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 1, 1, 1, 2 })] set; } internal Tolerance TimeSpanTolerance { get; set; } = Tolerance.Default; internal Tolerance FloatingPointTolerance { get; set; } = Tolerance.Default; internal Tolerance FixedPointTolerance { get; set; } = Tolerance.Default; protected void SetTolerance(object amount) { Tolerance tolerance = amount as Tolerance; if (tolerance == null) tolerance = new Tolerance(amount); if (tolerance.Amount is TimeSpan) TimeSpanTolerance = tolerance; else if (Numerics.IsFloatingPointNumeric(tolerance.Amount) || tolerance.Mode == ToleranceMode.Ulps) { FloatingPointTolerance = tolerance; } else { FixedPointTolerance = tolerance; } } } }