From dd64bd0f68b656956aed31e912f5ef49edcaad79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Breu=C3=9F?= Date: Tue, 28 Apr 2026 14:05:47 +0200 Subject: [PATCH 1/3] refactor: update property verification methods to use typed verification --- Source/Mockolate/Verify/VerificationPropertyResult.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Mockolate/Verify/VerificationPropertyResult.cs b/Source/Mockolate/Verify/VerificationPropertyResult.cs index d35021ee..5b1d61e9 100644 --- a/Source/Mockolate/Verify/VerificationPropertyResult.cs +++ b/Source/Mockolate/Verify/VerificationPropertyResult.cs @@ -47,18 +47,18 @@ public VerificationPropertyResult(TSubject subject, MockRegistry mockRegistry, /// Verifies the property read access on the mock. /// public VerificationResult Got() - => _mockRegistry.VerifyProperty(_subject, _getMemberId, _propertyName); + => _mockRegistry.VerifyPropertyTyped(_subject, _getMemberId, _propertyName); /// /// Verifies the property write access on the mock with the given . /// public VerificationResult Set(IParameter value) - => _mockRegistry.VerifyProperty(_subject, _setMemberId, _propertyName, (IParameterMatch)value); + => _mockRegistry.VerifyPropertyTyped(_subject, _setMemberId, _propertyName, (IParameterMatch)value); /// /// Verifies the property write access on the mock with the given . /// [OverloadResolutionPriority(1)] public VerificationResult Set(TParameter value, [CallerArgumentExpression(nameof(value))] string doNotPopulateThisValue = "") - => _mockRegistry.VerifyProperty(_subject, _setMemberId, _propertyName, (IParameterMatch)It.Is(value, doNotPopulateThisValue)); + => _mockRegistry.VerifyPropertyTyped(_subject, _setMemberId, _propertyName, (IParameterMatch)It.Is(value, doNotPopulateThisValue)); } From 782d3dde2e003027c511605971e3200a76db0fae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Breu=C3=9F?= Date: Tue, 28 Apr 2026 16:44:41 +0200 Subject: [PATCH 2/3] refactor: update verification methods to use typed subscriptions and unsubscriptions --- Source/Mockolate/Verify/VerificationEventResult.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Mockolate/Verify/VerificationEventResult.cs b/Source/Mockolate/Verify/VerificationEventResult.cs index aa42f077..0ff19c85 100644 --- a/Source/Mockolate/Verify/VerificationEventResult.cs +++ b/Source/Mockolate/Verify/VerificationEventResult.cs @@ -44,11 +44,11 @@ public VerificationEventResult(TSubject subject, MockRegistry mockRegistry, /// Verifies the subscriptions for the event. /// public VerificationResult Subscribed() - => _mockRegistry.SubscribedTo(_subject, _subscribeMemberId, _name); + => _mockRegistry.SubscribedToTyped(_subject, _subscribeMemberId, _name); /// /// Verifies the unsubscriptions from the event. /// public VerificationResult Unsubscribed() - => _mockRegistry.UnsubscribedFrom(_subject, _unsubscribeMemberId, _name); + => _mockRegistry.UnsubscribedFromTyped(_subject, _unsubscribeMemberId, _name); } From fceef299dc5bc94c7b2c7d62a8760592c2f021f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Breu=C3=9F=20Valentin?= Date: Tue, 28 Apr 2026 19:09:46 +0200 Subject: [PATCH 3/3] Fix review issues --- .../Verify/VerificationPropertyResult.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Source/Mockolate/Verify/VerificationPropertyResult.cs b/Source/Mockolate/Verify/VerificationPropertyResult.cs index 5b1d61e9..7a08914a 100644 --- a/Source/Mockolate/Verify/VerificationPropertyResult.cs +++ b/Source/Mockolate/Verify/VerificationPropertyResult.cs @@ -1,3 +1,4 @@ +using System.Diagnostics; using System.Runtime.CompilerServices; using Mockolate.Parameters; @@ -7,17 +8,17 @@ namespace Mockolate.Verify; /// Verifications on a property of type . /// #if !DEBUG -[System.Diagnostics.DebuggerNonUserCode] +[DebuggerNonUserCode] #endif public class VerificationPropertyResult { private const int NoMemberId = -1; + private readonly int _getMemberId; private readonly MockRegistry _mockRegistry; private readonly string _propertyName; - private readonly TSubject _subject; - private readonly int _getMemberId; private readonly int _setMemberId; + private readonly TSubject _subject; /// public VerificationPropertyResult(TSubject subject, MockRegistry mockRegistry, string propertyName) @@ -53,12 +54,14 @@ public VerificationResult Got() /// Verifies the property write access on the mock with the given . /// public VerificationResult Set(IParameter value) - => _mockRegistry.VerifyPropertyTyped(_subject, _setMemberId, _propertyName, (IParameterMatch)value); + => _mockRegistry.VerifyPropertyTyped(_subject, _setMemberId, _propertyName, value.AsParameterMatch()); /// /// Verifies the property write access on the mock with the given . /// [OverloadResolutionPriority(1)] - public VerificationResult Set(TParameter value, [CallerArgumentExpression(nameof(value))] string doNotPopulateThisValue = "") - => _mockRegistry.VerifyPropertyTyped(_subject, _setMemberId, _propertyName, (IParameterMatch)It.Is(value, doNotPopulateThisValue)); + public VerificationResult Set(TParameter value, + [CallerArgumentExpression(nameof(value))] string doNotPopulateThisValue = "") + => _mockRegistry.VerifyPropertyTyped(_subject, _setMemberId, _propertyName, + It.Is(value, doNotPopulateThisValue).AsParameterMatch()); }