Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ private static void ReportAssertAreAllDistinctFailed<T>(IEnumerable<T> collectio

#endregion // AreAllDistinct

// TODO: Deduplicate with the same adapter in Assert.CollectionEquivalence.cs (introduced by PR #8234)
// once both PRs have landed.
// Adapts a non-generic IEqualityComparer to IEqualityComparer<object?> for assertion helpers.
[StackTraceHidden]
private sealed class NonGenericEqualityComparerAdapter : IEqualityComparer<object?>
Comment thread
Evangelink marked this conversation as resolved.
{
private readonly IEqualityComparer _comparer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ private static void ReportAssertAreAllOfTypeFailed(IEnumerable<object?> collecti
ReportAssertFailed(structured);
}

[StackTraceHidden]
private readonly struct TypeMismatch
{
public TypeMismatch(int index, Type? actualType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public sealed partial class Assert
/// <summary>
/// Walks two object graphs and reports the first structural difference, if any.
/// </summary>
[StackTraceHidden]
private sealed partial class EquivalenceComparer
Comment thread
Evangelink marked this conversation as resolved.
{
// Member info caches keyed by runtime type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public sealed partial class Assert
/// Routes lookups back to the source dictionary so the source's own
/// <see cref="IEqualityComparer{T}"/> for keys is preserved.
/// </summary>
[StackTraceHidden]
private abstract class DictionaryView
{
internal abstract IEnumerable<KeyValuePair<object, object?>> Entries { get; }
Expand All @@ -30,6 +31,7 @@ internal DictionaryLookup TryGetValuePair(object key)
}
}

[StackTraceHidden]
private readonly struct DictionaryLookup
{
internal DictionaryLookup(bool found, object? value)
Expand All @@ -43,6 +45,7 @@ internal DictionaryLookup(bool found, object? value)
internal object? Value { get; }
}

[StackTraceHidden]
private sealed class NonGenericDictionaryView : DictionaryView
{
private readonly IDictionary _source;
Expand Down Expand Up @@ -84,6 +87,7 @@ internal override bool TryGetValue(object key, out object? value)
}
}

[StackTraceHidden]
private sealed class GenericDictionaryView : DictionaryView
{
private static readonly ConcurrentDictionary<Type, GenericDictionaryAccessors> AccessorCache = new();
Expand Down Expand Up @@ -123,6 +127,7 @@ internal override bool TryGetValue(object key, out object? value)
/// source's native methods (<c>TryGetValue</c>, <c>ContainsKey</c>) so the source's
/// <see cref="IEqualityComparer{TKey}"/> is honored.
/// </summary>
[StackTraceHidden]
private sealed class GenericDictionaryAccessors
{
private readonly MethodInfo _tryGetValueMethod;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public sealed partial class Assert
/// <summary>
/// Reference-equality comparer used for keys in the topology maps of <see cref="EquivalenceComparer"/>.
/// </summary>
[StackTraceHidden]
private sealed class ReferenceObjectComparer : IEqualityComparer<object>
{
internal static readonly ReferenceObjectComparer Instance = new();
Expand All @@ -25,6 +26,7 @@ private ReferenceObjectComparer()
/// Cached set of public instance properties and fields for a type, with both an alphabetically-sorted
/// array (for deterministic traversal) and a name-keyed dictionary (for O(1) lookup).
/// </summary>
[StackTraceHidden]
private sealed class MemberLookup
{
internal MemberLookup(MemberAccessor[] sorted, IReadOnlyDictionary<string, MemberAccessor> byName)
Expand All @@ -41,6 +43,7 @@ internal MemberLookup(MemberAccessor[] sorted, IReadOnlyDictionary<string, Membe
/// <summary>
/// Describes how to read a single member (property or field) from an instance.
/// </summary>
[StackTraceHidden]
private sealed class MemberAccessor
{
private readonly PropertyInfo? _property;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public sealed partial class Assert
/// A single structural mismatch found by <see cref="EquivalenceComparer"/>, carrying the dotted
/// member path, a localized reason summary, and any expected/actual snippets to render.
/// </summary>
[StackTraceHidden]
private sealed class EquivalenceMismatch
{
private EquivalenceMismatch(string path, string reason, string? expectedText, string? actualText, bool isComparisonFailure)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,7 @@ private enum ThrowsFailureKind : byte
WrongExceptionType,
}

[StackTraceHidden]
private readonly struct ThrowsExceptionState
{
public Exception? ExceptionThrown { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ private static string ConstructFinalMessage(
/// <summary>
/// compares the objects using object.Equals.
/// </summary>
[StackTraceHidden]
private sealed class ObjectComparer : IComparer
{
int IComparer.Compare(object? x, object? y) => Equals(x, y) ? 0 : -1;
Expand Down