Skip to content

Commit 14cbf10

Browse files
committed
use TValue.Equals because its more flexible than IEqualityComparer
1 parent a0305d5 commit 14cbf10

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

Source/Core/Mocking/Spring.Mocking.Matching.pas

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -453,17 +453,11 @@ class function TArg.IsAny<T>(const condition: Predicate<T>): T;
453453
end;
454454

455455
class function TArg.IsEqual<T>(const value: T): T;
456-
var
457-
comparer: IEqualityComparer<T>;
458456
begin
459-
comparer := IEqualityComparer<T>(_LookupVtableInfo(giEqualityComparer, TypeInfo(T), SizeOf(T)));
460457
Result := TMatcherFactory.CreateMatcher<T>(
461458
function(const arg: TValue): Boolean
462-
var
463-
argValue: T;
464459
begin
465-
arg.AsType(TypeInfo(T), argValue);
466-
Result := comparer.Equals(argValue, value);
460+
Result := arg.Convert<T>.Equals(TValue.From<T>(value));
467461
end);
468462
end;
469463

0 commit comments

Comments
 (0)