Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
refactor(mocks): exclude transient KeepOutParamsInExtensionSignature …
…from model equality

The flag is computed ephemerally in Build() via ApplyOutDisambiguation
and is never true on models flowing through the incremental pipeline,
so it should not participate in model identity.
  • Loading branch information
thomhurst committed Apr 7, 2026
commit c6e63380c1c4ae72f42aa3533cb8fa276bf942d8
7 changes: 4 additions & 3 deletions TUnit.Mocks.SourceGenerator/Models/MockMemberModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ internal sealed record MockMemberModel : IEquatable<MockMemberModel>
/// matchable-parameter signature (e.g. <c>BlobClient.GenerateSasUri(perms, expires)</c> vs
/// <c>GenerateSasUri(perms, expires, out string stringToSign)</c>). When true, callers must
/// pass <c>out _</c> at the call site for the disambiguated overload.
/// Computed across the full method set in <see cref="Builders.MockMembersBuilder"/>.
/// Computed transiently inside <see cref="Builders.MockMembersBuilder.Build"/> by examining
/// the full method set; never set on models flowing through the incremental pipeline.
/// Excluded from <see cref="Equals(MockMemberModel?)"/> / <see cref="GetHashCode"/> because
/// it is a derived per-build flag, not part of model identity.
/// </summary>
public bool KeepOutParamsInExtensionSignature { get; init; }

Expand Down Expand Up @@ -96,7 +99,6 @@ public bool Equals(MockMemberModel? other)
&& IsRefStructReturn == other.IsRefStructReturn
&& IsStaticAbstract == other.IsStaticAbstract
&& IsReturnTypeStaticAbstractInterface == other.IsReturnTypeStaticAbstractInterface
&& KeepOutParamsInExtensionSignature == other.KeepOutParamsInExtensionSignature
&& SpanReturnElementType == other.SpanReturnElementType;
}

Expand All @@ -111,7 +113,6 @@ public override int GetHashCode()
hash = hash * 31 + Parameters.GetHashCode();
hash = hash * 31 + IsStaticAbstract.GetHashCode();
hash = hash * 31 + IsReturnTypeStaticAbstractInterface.GetHashCode();
hash = hash * 31 + KeepOutParamsInExtensionSignature.GetHashCode();
hash = hash * 31 + (ExplicitInterfaceName?.GetHashCode() ?? 0);
hash = hash * 31 + (DeclaringInterfaceName?.GetHashCode() ?? 0);
return hash;
Expand Down
Loading