Skip to content

Commit 8d196cb

Browse files
authored
Add provider-neutral verification and provider discovery (#113)
* Add provider-neutral verification and discovery support * Fix provider-neutral matcher verification follow-ups * Finalize FastArg verification guidance * Add provider discovery mode controls
1 parent cc9b7fe commit 8d196cb

35 files changed

Lines changed: 3276 additions & 151 deletions

Directory.Packages.props

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@
4747

4848
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
4949
<PackageVersion Include="Microsoft.Azure.Functions.Worker" Version="2.51.0" />
50-
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="10.*" />
51-
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.*" />
52-
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.*" />
53-
<PackageVersion Include="Microsoft.Extensions.Options" Version="10.*" />
54-
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="10.*" />
50+
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="10.0.6" />
51+
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.6" />
52+
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.6" />
53+
<PackageVersion Include="Microsoft.Extensions.Options" Version="10.0.6" />
54+
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="10.0.6" />
5555
</ItemGroup>
5656
</Project>

FastMoq.Abstractions/FastMoq.Abstractions.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@
4040
<ItemGroup>
4141
<FrameworkReference Include="Microsoft.AspNetCore.App" />
4242
</ItemGroup>
43+
4344
</Project>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using System.Linq.Expressions;
2+
3+
namespace FastMoq.Providers
4+
{
5+
/// <summary>
6+
/// Provider-neutral argument matcher helpers for FastMoq expression-based setup and verification flows.
7+
/// </summary>
8+
public static class FastArg
9+
{
10+
/// <summary>
11+
/// Matches any argument of type <typeparamref name="T" />.
12+
/// </summary>
13+
/// <remarks>
14+
/// Use this only inside FastMoq-supported expression-based setup or verification APIs.
15+
/// </remarks>
16+
public static T Any<T>() => default!;
17+
18+
/// <summary>
19+
/// Matches any expression argument of type <c>Expression&lt;Func&lt;T, bool&gt;&gt;</c>.
20+
/// </summary>
21+
/// <remarks>
22+
/// This is the provider-neutral replacement for older wildcard expression helpers such as <c>Mocker.BuildExpression&lt;T&gt;()</c> in new code.
23+
/// </remarks>
24+
public static Expression<Func<T, bool>> AnyExpression<T>() => _ => true;
25+
26+
/// <summary>
27+
/// Matches an argument when the supplied predicate returns <see langword="true" />.
28+
/// </summary>
29+
/// <param name="predicate">The predicate used to evaluate the runtime argument.</param>
30+
public static T Is<T>(Expression<Func<T, bool>> predicate)
31+
{
32+
ArgumentNullException.ThrowIfNull(predicate);
33+
return default!;
34+
}
35+
36+
/// <summary>
37+
/// Matches a <see langword="null" /> argument.
38+
/// </summary>
39+
public static T IsNull<T>() => default!;
40+
41+
/// <summary>
42+
/// Matches a non-<see langword="null" /> argument.
43+
/// </summary>
44+
public static T IsNotNull<T>() => default!;
45+
}
46+
}

0 commit comments

Comments
 (0)