-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move benchmark test data to its own class
- Loading branch information
1 parent
d37add0
commit afdc5d2
Showing
2 changed files
with
36 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System.Reflection; | ||
using BenchmarkMockNet.Benchmarks; | ||
using Xunit; | ||
|
||
namespace BenchmarkMockNet.Tests; | ||
|
||
public class BenchmarkData : TheoryData<Type, MethodInfo> | ||
{ | ||
public BenchmarkData() | ||
{ | ||
var methods = typeof(IMockingBenchmark).GetMethods(); | ||
|
||
foreach (var benchmark in Benchmarks) | ||
{ | ||
foreach (var method in methods) | ||
{ | ||
Add(benchmark.Key, method); | ||
} | ||
} | ||
} | ||
|
||
public static readonly Dictionary<Type, Func<object?, bool>> Benchmarks = new() | ||
{ | ||
{ typeof(Construction), result => result is IThing }, | ||
{ typeof(Callback), result => result is true }, | ||
{ typeof(EmptyMethod), result => result is null }, | ||
{ typeof(EmptyReturn), result => result is 0 }, | ||
{ typeof(OneParameter), result => result is null }, | ||
{ typeof(Return), result => result is 1 }, | ||
{ typeof(Verify), result => result is null } | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters