diff --git a/Source/Mockolate.SourceGenerators/Sources/Sources.IndexerSetups.cs b/Source/Mockolate.SourceGenerators/Sources/Sources.IndexerSetups.cs
index defc523d..7b15adf9 100644
--- a/Source/Mockolate.SourceGenerators/Sources/Sources.IndexerSetups.cs
+++ b/Source/Mockolate.SourceGenerators/Sources/Sources.IndexerSetups.cs
@@ -132,7 +132,9 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
.AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\t/// ").AppendLine();
- sb.Append("\t\t/// The callback receives the parameters of the indexer and the value of the indexer as last parameter.").AppendLine();
+ sb.Append(
+ "\t\t/// The callback receives the parameters of the indexer and the value of the indexer as last parameter.")
+ .AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tIIndexerSetupCallbackBuilder Do(Action<")
.Append(typeParams)
@@ -145,7 +147,9 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
.AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\t/// ").AppendLine();
- sb.Append("\t\t/// The callback receives an incrementing access counter as first parameter, the parameters of the indexer and the value of the indexer as last parameter.").AppendLine();
+ sb.Append(
+ "\t\t/// The callback receives an incrementing access counter as first parameter, the parameters of the indexer and the value of the indexer as last parameter.")
+ .AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tIIndexerSetupCallbackBuilder Do(Action").AppendLine();
sb.Append("\t\t/// ").AppendLine();
- sb.Append("\t\t/// The callback receives the value the indexer is set to as single parameter.").AppendLine();
+ sb.Append("\t\t/// The callback receives the value the indexer is set to as single parameter.")
+ .AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tIIndexerSetupCallbackBuilder Do(Action callback);").AppendLine();
@@ -192,7 +197,9 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
.AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\t/// ").AppendLine();
- sb.Append("\t\t/// The callback receives the parameters of the indexer and the value the indexer is set to as last parameter.").AppendLine();
+ sb.Append(
+ "\t\t/// The callback receives the parameters of the indexer and the value the indexer is set to as last parameter.")
+ .AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tIIndexerSetupCallbackBuilder Do(Action<")
.Append(typeParams).Append(", TValue> callback);").AppendLine();
@@ -204,7 +211,9 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
.AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\t/// ").AppendLine();
- sb.Append("\t\t/// The callback receives an incrementing access counter as first parameter, the parameters of the indexer and the value the indexer is set to as last parameter.").AppendLine();
+ sb.Append(
+ "\t\t/// The callback receives an incrementing access counter as first parameter, the parameters of the indexer and the value the indexer is set to as last parameter.")
+ .AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tIIndexerSetupCallbackBuilder Do(Action callback);").AppendLine();
@@ -229,14 +238,14 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t\tIIndexerGetterSetup OnGet { get; }").AppendLine();
sb.AppendLine();
-
+
sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\t/// Sets up callbacks on the setter.").AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tIIndexerSetterSetup OnSet { get; }").AppendLine();
sb.AppendLine();
-
+
sb.Append("\t\t/// ").AppendLine();
sb.Append(
"\t\t/// Flag indicating if the base class implementation should be called, and its return values used as default values.")
@@ -297,7 +306,9 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
.AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\t/// ").AppendLine();
- sb.Append("\t\t/// The callback receives the parameters of the indexer and the value of the indexer as last parameter.").AppendLine();
+ sb.Append(
+ "\t\t/// The callback receives the parameters of the indexer and the value of the indexer as last parameter.")
+ .AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tIIndexerSetupReturnBuilder Returns(Func<")
.Append(typeParams).Append(", TValue, TValue> callback);").AppendLine();
@@ -349,7 +360,9 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
.AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\t/// ").AppendLine();
- sb.Append("\t\t/// The callback receives the parameters of the indexer and the value of the indexer as last parameter.").AppendLine();
+ sb.Append(
+ "\t\t/// The callback receives the parameters of the indexer and the value of the indexer as last parameter.")
+ .AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tIIndexerSetupReturnBuilder Throws(Func<")
.Append(typeParams).Append(", TValue, Exception> callback);").AppendLine();
@@ -408,7 +421,7 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t{").AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append(
- "\t\t/// Limits the callback to only execute for the given number of .")
+ "\t\t/// Repeats the callback for the given number of .")
.AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\t/// ").AppendLine();
@@ -478,7 +491,7 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t{").AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append(
- "\t\t/// Limits the callback to only execute for the given number of .")
+ "\t\t/// Repeats the callback for the given number of .")
.AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\t/// ").AppendLine();
@@ -543,7 +556,8 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t\tprivate Func<").Append(typeParams).Append(", TValue>? _initialization;").AppendLine();
sb.AppendLine();
- sb.Append("\t\t/// ").AppendLine();
+ sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tpublic IIndexerSetup CallingBaseClass(bool callBaseClass = true)")
.AppendLine();
@@ -553,7 +567,8 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
- sb.Append("\t\t/// ").AppendLine();
+ sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tpublic IIndexerSetup InitializeWith(TValue value)")
.AppendLine();
sb.Append("\t\t{").AppendLine();
@@ -569,7 +584,8 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
- sb.Append("\t\t/// ").AppendLine();
+ sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tpublic IIndexerSetup InitializeWith(Func<")
.Append(typeParams).Append(", TValue> valueGenerator)").AppendLine();
sb.Append("\t\t{").AppendLine();
@@ -585,13 +601,15 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
- sb.Append("\t\t/// ").AppendLine();
+ sb.Append("\t\t/// ")
+ .AppendLine();
sb.Append("\t\tpublic IIndexerGetterSetup OnGet").AppendLine();
sb.Append("\t\t\t=> this;").AppendLine();
sb.AppendLine();
- sb.Append("\t\t/// ").AppendLine();
+ sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tIIndexerSetupCallbackBuilder IIndexerGetterSetup.Do(Action callback)").AppendLine();
@@ -604,8 +622,10 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
- sb.Append("\t\t/// ").AppendLine();
- sb.Append("\t\tIIndexerSetupCallbackBuilder IIndexerGetterSetup").AppendLine();
+ sb.Append("\t\tIIndexerSetupCallbackBuilder IIndexerGetterSetup.Do(Action<")
.Append(typeParams)
.Append("> callback)").AppendLine();
@@ -618,8 +638,10 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
- sb.Append("\t\t/// ").AppendLine();
- sb.Append("\t\tIIndexerSetupCallbackBuilder IIndexerGetterSetup").AppendLine();
+ sb.Append("\t\tIIndexerSetupCallbackBuilder IIndexerGetterSetup.Do(Action<")
.Append(typeParams)
.Append(", TValue> callback)").AppendLine();
@@ -632,13 +654,16 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
- sb.Append("\t\t/// ").AppendLine();
- sb.Append("\t\tIIndexerSetupCallbackBuilder IIndexerGetterSetup").AppendLine();
+ sb.Append("\t\tIIndexerSetupCallbackBuilder IIndexerGetterSetup.Do(Action callback)").AppendLine();
sb.Append("\t\t{").AppendLine();
- sb.Append("\t\t\tCallback>? currentCallback = new(callback);")
+ sb.Append("\t\t\tCallback>? currentCallback = new(callback);")
.AppendLine();
sb.Append("\t\t\t_currentCallback = currentCallback;").AppendLine();
sb.Append("\t\t\t_getterCallbacks.Add(currentCallback);").AppendLine();
@@ -646,13 +671,15 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
- sb.Append("\t\t/// ").AppendLine();
+ sb.Append("\t\t/// ")
+ .AppendLine();
sb.Append("\t\tpublic IIndexerSetterSetup OnSet").AppendLine();
sb.Append("\t\t\t=> this;").AppendLine();
sb.AppendLine();
- sb.Append("\t\t/// ").AppendLine();
+ sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tIIndexerSetupCallbackBuilder IIndexerSetterSetup.Do(Action callback)").AppendLine();
@@ -665,7 +692,8 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
- sb.Append("\t\t/// ").AppendLine();
+ sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tIIndexerSetupCallbackBuilder IIndexerSetterSetup.Do(Action callback)")
@@ -679,7 +707,8 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
- sb.Append("\t\t/// ").AppendLine();
+ sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tIIndexerSetupCallbackBuilder IIndexerSetterSetup.Do(Action<")
@@ -693,7 +722,8 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
- sb.Append("\t\t/// ").AppendLine();
+ sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tIIndexerSetupCallbackBuilder IIndexerSetterSetup.Do(Action").AppendLine();
+ sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tpublic IIndexerSetupReturnBuilder Returns(TValue returnValue)")
.AppendLine();
@@ -721,7 +752,8 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
- sb.Append("\t\t/// ").AppendLine();
+ sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tpublic IIndexerSetupReturnBuilder Returns(Func callback)")
.AppendLine();
@@ -734,13 +766,15 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
- sb.Append("\t\t/// ").AppendLine();
+ sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tpublic IIndexerSetupReturnBuilder Returns(Func<")
.Append(typeParams)
.Append(", TValue> callback)").AppendLine();
sb.Append("\t\t{").AppendLine();
sb.Append("\t\t\tvar currentCallback = new Callback>((_, ").Append(parameters).Append(", _) => callback(").Append(parameters).Append("));")
+ .Append(", TValue, TValue>>((_, ").Append(parameters).Append(", _) => callback(").Append(parameters)
+ .Append("));")
.AppendLine();
sb.Append("\t\t\t_currentReturnCallback = currentCallback;").AppendLine();
sb.Append("\t\t\t_returnCallbacks.Add(currentCallback);").AppendLine();
@@ -748,7 +782,8 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
- sb.Append("\t\t/// ").AppendLine();
+ sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tpublic IIndexerSetupReturnBuilder Returns(Func<")
.Append(typeParams).Append(", TValue, TValue> callback)").AppendLine();
sb.Append("\t\t{").AppendLine();
@@ -761,7 +796,8 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
- sb.Append("\t\t/// ").AppendLine();
+ sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tpublic IIndexerSetupReturnBuilder Throws()")
.AppendLine();
sb.Append("\t\t\twhere TException : Exception, new()").AppendLine();
@@ -774,7 +810,8 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
- sb.Append("\t\t/// ").AppendLine();
+ sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tpublic IIndexerSetupReturnBuilder Throws(Exception exception)")
.AppendLine();
@@ -787,7 +824,8 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
- sb.Append("\t\t/// ").AppendLine();
+ sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tpublic IIndexerSetupReturnBuilder Throws(Func callback)")
.AppendLine();
@@ -800,7 +838,8 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
- sb.Append("\t\t/// ").AppendLine();
+ sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tpublic IIndexerSetupReturnBuilder Throws(Func<")
.Append(typeParams)
.Append(", Exception> callback)").AppendLine();
@@ -814,7 +853,8 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
- sb.Append("\t\t/// ").AppendLine();
+ sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\tpublic IIndexerSetupReturnBuilder Throws(Func<")
.Append(typeParams).Append(", TValue, Exception> callback)").AppendLine();
sb.Append("\t\t{").AppendLine();
@@ -856,7 +896,7 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
.Append(typeParams)
.Append(">.For(int times)").AppendLine();
sb.Append("\t\t{").AppendLine();
- sb.Append("\t\t\t_currentCallback?.For(x => x < times);").AppendLine();
+ sb.Append("\t\t\t_currentCallback?.For(times);").AppendLine();
sb.Append("\t\t\treturn this;").AppendLine();
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
@@ -890,7 +930,7 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
.Append(typeParams)
.Append(">.For(int times)").AppendLine();
sb.Append("\t\t{").AppendLine();
- sb.Append("\t\t\t_currentReturnCallback?.For(x => x < times);").AppendLine();
+ sb.Append("\t\t\t_currentReturnCallback?.For(times);").AppendLine();
sb.Append("\t\t\treturn this;").AppendLine();
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
@@ -929,7 +969,8 @@ private static void AppendIndexerSetup(StringBuilder sb, int numberOfParameters)
sb.Append("\t\t\t\tint currentGetterCallbacksIndex = _currentGetterCallbacksIndex;").AppendLine();
sb.Append("\t\t\t\tfor (int i = 0; i < _getterCallbacks.Count; i++)").AppendLine();
sb.Append("\t\t\t\t{").AppendLine();
- sb.Append("\t\t\t\t\tCallback> getterCallback =").AppendLine();
+ sb.Append("\t\t\t\t\tCallback> getterCallback =")
+ .AppendLine();
sb.Append("\t\t\t\t\t\t_getterCallbacks[(currentGetterCallbacksIndex + i) % _getterCallbacks.Count];")
.AppendLine();
sb.Append(
diff --git a/Source/Mockolate.SourceGenerators/Sources/Sources.MethodSetups.cs b/Source/Mockolate.SourceGenerators/Sources/Sources.MethodSetups.cs
index 51f1f4c0..4da2de2f 100644
--- a/Source/Mockolate.SourceGenerators/Sources/Sources.MethodSetups.cs
+++ b/Source/Mockolate.SourceGenerators/Sources/Sources.MethodSetups.cs
@@ -258,7 +258,7 @@ private static void AppendVoidMethodSetup(StringBuilder sb, int numberOfParamete
sb.Append("{").AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append(
- "\t\t/// Limits the callback to only execute for the given number of .")
+ "\t\t/// Repeats the callback for the given number of .")
.AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\t/// ").AppendLine();
@@ -331,7 +331,7 @@ private static void AppendVoidMethodSetup(StringBuilder sb, int numberOfParamete
sb.Append("{").AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append(
- "\t\t/// Limits the throw to only execute for the given number of .")
+ "\t\t/// Repeats the throw for the given number of .")
.AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\t/// ").AppendLine();
@@ -599,7 +599,7 @@ private static void AppendVoidMethodSetup(StringBuilder sb, int numberOfParamete
.Append(typeParams)
.Append(">.For(int times)").AppendLine();
sb.Append("\t\t{").AppendLine();
- sb.Append("\t\t\t_currentCallback?.For(x => x < times);").AppendLine();
+ sb.Append("\t\t\t_currentCallback?.For(times);").AppendLine();
sb.Append("\t\t\treturn this;").AppendLine();
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
@@ -633,7 +633,7 @@ private static void AppendVoidMethodSetup(StringBuilder sb, int numberOfParamete
.Append(typeParams)
.Append(">.For(int times)").AppendLine();
sb.Append("\t\t{").AppendLine();
- sb.Append("\t\t\t_currentReturnCallback?.For(x => x < times);").AppendLine();
+ sb.Append("\t\t\t_currentReturnCallback?.For(times);").AppendLine();
sb.Append("\t\t\treturn this;").AppendLine();
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
@@ -967,7 +967,7 @@ private static void AppendReturnMethodSetup(StringBuilder sb, int numberOfParame
sb.Append("{").AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append(
- "\t\t/// Limits the callback to only execute for the given number of .")
+ "\t\t/// Repeats the callback for the given number of .")
.AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\t/// ").AppendLine();
@@ -1039,7 +1039,7 @@ private static void AppendReturnMethodSetup(StringBuilder sb, int numberOfParame
sb.Append("{").AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append(
- "\t\t/// Limits the callback to only execute for the given number of .")
+ "\t\t/// Repeats the callback for the given number of .")
.AppendLine();
sb.Append("\t\t/// ").AppendLine();
sb.Append("\t\t/// ").AppendLine();
@@ -1345,7 +1345,7 @@ private static void AppendReturnMethodSetup(StringBuilder sb, int numberOfParame
.Append("> IReturnMethodSetupCallbackWhenBuilder.For(int times)").AppendLine();
sb.Append("\t\t{").AppendLine();
- sb.Append("\t\t\t_currentCallback?.For(x => x < times);").AppendLine();
+ sb.Append("\t\t\t_currentCallback?.For(times);").AppendLine();
sb.Append("\t\t\treturn this;").AppendLine();
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
@@ -1378,7 +1378,7 @@ private static void AppendReturnMethodSetup(StringBuilder sb, int numberOfParame
.Append("> IReturnMethodSetupReturnWhenBuilder.For(int times)").AppendLine();
sb.Append("\t\t{").AppendLine();
- sb.Append("\t\t\t_currentReturnCallback?.For(x => x < times);").AppendLine();
+ sb.Append("\t\t\t_currentReturnCallback?.For(times);").AppendLine();
sb.Append("\t\t\treturn this;").AppendLine();
sb.Append("\t\t}").AppendLine();
sb.AppendLine();
diff --git a/Source/Mockolate/Setup/Callback.cs b/Source/Mockolate/Setup/Callback.cs
index e0e29a84..35b8961f 100644
--- a/Source/Mockolate/Setup/Callback.cs
+++ b/Source/Mockolate/Setup/Callback.cs
@@ -8,8 +8,8 @@ namespace Mockolate.Setup;
///
public class Callback
{
+ private int? _forTimes;
private Func? _invocationPredicate;
- private Func? _matchingPredicate;
private int _onlyTimes;
///
@@ -20,7 +20,7 @@ public class Callback
///
/// Check if a -predicate was specified.
///
- protected bool HasForSpecified => _matchingPredicate != null;
+ protected bool HasForSpecified => _forTimes != null;
///
/// Flag indicating whether the callback is active.
@@ -45,15 +45,15 @@ public void When(Func predicate)
=> _invocationPredicate = predicate;
///
- /// Limits the callback to only execute for matching property accesses where the predicate returns
+ /// Repeats the callback for the given number of .
/// .
///
///
- /// The number of times is only counted for actual executions ( evaluates to
- /// ).
+ /// The number of times is only counted for actual executions ( evaluates
+ /// to ).
///
- public void For(Func predicate)
- => _matchingPredicate = predicate;
+ public void For(int times)
+ => _forTimes = times;
///
/// Deactivates the callback after it was invoked the given number of .
@@ -82,10 +82,10 @@ protected bool CheckInvocations(int invocationCount)
=> _invocationPredicate?.Invoke(invocationCount) ?? true;
///
- /// Check if the invocation count satisfies the -predicate.
+ /// Check if the callback should be repeated (at least) once more.
///
protected bool CheckMatching(int matchingCount)
- => _matchingPredicate?.Invoke(matchingCount) ?? true;
+ => _forTimes is null || matchingCount < _forTimes;
}
///
diff --git a/Source/Mockolate/Setup/IndexerSetup.cs b/Source/Mockolate/Setup/IndexerSetup.cs
index bf2d6013..05c94b28 100644
--- a/Source/Mockolate/Setup/IndexerSetup.cs
+++ b/Source/Mockolate/Setup/IndexerSetup.cs
@@ -355,7 +355,7 @@ IIndexerSetupCallbackBuilder IIndexerSetupCallbackBuilder
IIndexerSetupCallbackWhenBuilder IIndexerSetupCallbackWhenBuilder.For(int times)
{
- _currentCallback?.For(x => x < times);
+ _currentCallback?.For(times);
return this;
}
@@ -376,7 +376,7 @@ IIndexerSetupReturnWhenBuilder IIndexerSetupReturnBuilder
IIndexerSetupReturnWhenBuilder IIndexerSetupReturnWhenBuilder.For(int times)
{
- _currentReturnCallback?.For(x => x < times);
+ _currentReturnCallback?.For(times);
return this;
}
@@ -711,7 +711,7 @@ IIndexerSetupCallbackBuilder IIndexerSetupCallbackBuilder
IIndexerSetupCallbackWhenBuilder IIndexerSetupCallbackWhenBuilder.For(int times)
{
- _currentCallback?.For(x => x < times);
+ _currentCallback?.For(times);
return this;
}
@@ -733,7 +733,7 @@ IIndexerSetupReturnWhenBuilder IIndexerSetupReturnBuilder
IIndexerSetupReturnWhenBuilder IIndexerSetupReturnWhenBuilder.For(int times)
{
- _currentReturnCallback?.For(x => x < times);
+ _currentReturnCallback?.For(times);
return this;
}
@@ -1083,7 +1083,7 @@ IIndexerSetupCallbackBuilder IIndexerSetupCallbackBuilder IIndexerSetupCallbackWhenBuilder.
For(int times)
{
- _currentCallback?.For(x => x < times);
+ _currentCallback?.For(times);
return this;
}
@@ -1105,7 +1105,7 @@ IIndexerSetupReturnWhenBuilder IIndexerSetupReturnBuilder
IIndexerSetupReturnWhenBuilder IIndexerSetupReturnWhenBuilder.For(int times)
{
- _currentReturnCallback?.For(x => x < times);
+ _currentReturnCallback?.For(times);
return this;
}
@@ -1469,7 +1469,7 @@ IIndexerSetupCallbackBuilder IIndexerSetupCallbackBuilde
IIndexerSetupCallbackWhenBuilder IIndexerSetupCallbackWhenBuilder.
For(int times)
{
- _currentCallback?.For(x => x < times);
+ _currentCallback?.For(times);
return this;
}
@@ -1492,7 +1492,7 @@ IIndexerSetupReturnWhenBuilder IIndexerSetupReturnBuilde
IIndexerSetupReturnWhenBuilder IIndexerSetupReturnWhenBuilder.
For(int times)
{
- _currentReturnCallback?.For(x => x < times);
+ _currentReturnCallback?.For(times);
return this;
}
diff --git a/Source/Mockolate/Setup/Interfaces.IndexerSetup.cs b/Source/Mockolate/Setup/Interfaces.IndexerSetup.cs
index 96366484..deffdfd1 100644
--- a/Source/Mockolate/Setup/Interfaces.IndexerSetup.cs
+++ b/Source/Mockolate/Setup/Interfaces.IndexerSetup.cs
@@ -63,7 +63,8 @@ public interface IIndexerGetterSetup
/// Registers a callback to be invoked whenever the indexer's getter is accessed.
///
///
- /// The callback receives an incrementing access counter as first parameter, the parameter of the indexer and the value of the indexer as last parameter.
+ /// The callback receives an incrementing access counter as first parameter, the parameter of the indexer and the value
+ /// of the indexer as last parameter.
///
IIndexerSetupCallbackBuilder Do(Action callback);
}
@@ -98,7 +99,8 @@ public interface IIndexerSetterSetup
/// Registers a callback to be invoked whenever the indexer's setter is accessed.
///
///
- /// The callback receives an incrementing access counter as first parameter, the parameter of the indexer and the value the indexer is set to as last parameter.
+ /// The callback receives an incrementing access counter as first parameter, the parameter of the indexer and the value
+ /// the indexer is set to as last parameter.
///
IIndexerSetupCallbackBuilder Do(Action callback);
}
@@ -221,7 +223,7 @@ public interface IIndexerSetupCallbackWhenBuilder
: IIndexerSetup
{
///
- /// Limits the callback to only execute for the given number of .
+ /// Repeats the callback for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -264,7 +266,7 @@ public interface IIndexerSetupReturnWhenBuilder
: IIndexerSetup
{
///
- /// Limits the return/throw to only execute for the given number of .
+ /// Repeats the return/throw for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -276,14 +278,15 @@ public interface IIndexerSetupReturnWhenBuilder
/// Deactivates the return/throw after the given number of .
///
///
- /// The number of times is only counted for actual executions (
- /// evaluates to ).
+ /// The number of times is only counted for actual executions
+ /// ( evaluates to ).
///
IIndexerSetup Only(int times);
}
///
-/// Sets up a indexer getter for and .
+/// Sets up a indexer getter for and
+/// .
///
public interface IIndexerGetterSetup
{
@@ -312,14 +315,15 @@ public interface IIndexerGetterSetup
/// Registers a callback to be invoked whenever the indexer's getter is accessed.
///
///
- /// The callback receives an incrementing access counter as first parameter, the parameters of the indexer and the value of the indexer as last parameter.
+ /// The callback receives an incrementing access counter as first parameter, the parameters of the indexer and the
+ /// value of the indexer as last parameter.
///
IIndexerSetupCallbackBuilder Do(Action callback);
-
}
///
-/// Sets up a indexer setter for and .
+/// Sets up a indexer setter for and
+/// .
///
public interface IIndexerSetterSetup
{
@@ -348,7 +352,8 @@ public interface IIndexerSetterSetup
/// Registers a callback to be invoked whenever the indexer's setter is accessed.
///
///
- /// The callback receives an incrementing access counter as first parameter, the parameters of the indexer and the value the indexer is set to as last parameter.
+ /// The callback receives an incrementing access counter as first parameter, the parameters of the indexer and the
+ /// value the indexer is set to as last parameter.
///
IIndexerSetupCallbackBuilder Do(Action callback);
}
@@ -473,7 +478,7 @@ public interface IIndexerSetupCallbackWhenBuilder
: IIndexerSetup
{
///
- /// Limits the callback to only execute for the given number of .
+ /// Repeats the callback for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -518,13 +523,12 @@ public interface IIndexerSetupReturnWhenBuilder
: IIndexerSetup
{
///
- /// Limits the return/throw to only execute for the given number of .
+ /// Repeats the return/throw for the given number of .
///
///
- /// The number of times is only counted for actual executions (
- /// evaluates to
- ///
- /// ).
+ /// The number of times is only counted for actual executions
+ /// ( evaluates to
+ /// ).
///
IIndexerSetupReturnWhenBuilder For(int times);
@@ -540,7 +544,8 @@ public interface IIndexerSetupReturnWhenBuilder
}
///
-/// Sets up a indexer getter for , and
+/// Sets up a indexer getter for ,
+/// and
/// .
///
public interface IIndexerGetterSetup
@@ -570,13 +575,15 @@ public interface IIndexerGetterSetup
/// Registers a callback to be invoked whenever the indexer's getter is accessed.
///
///
- /// The callback receives an incrementing access counter as first parameter, the parameters of the indexer and the value of the indexer as last parameter.
+ /// The callback receives an incrementing access counter as first parameter, the parameters of the indexer and the
+ /// value of the indexer as last parameter.
///
IIndexerSetupCallbackBuilder Do(Action callback);
}
///
-/// Sets up a indexer setter for , and
+/// Sets up a indexer setter for ,
+/// and
/// .
///
public interface IIndexerSetterSetup
@@ -606,7 +613,8 @@ public interface IIndexerSetterSetup
/// Registers a callback to be invoked whenever the indexer's setter is accessed.
///
///
- /// The callback receives an incrementing access counter as first parameter, the parameters of the indexer and the value the indexer is set to as last parameter.
+ /// The callback receives an incrementing access counter as first parameter, the parameters of the indexer and the
+ /// value the indexer is set to as last parameter.
///
IIndexerSetupCallbackBuilder Do(Action callback);
}
@@ -732,7 +740,7 @@ public interface IIndexerSetupCallbackWhenBuilder
{
///
- /// Limits the callback to only execute for the given number of .
+ /// Repeats the callback for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -778,7 +786,7 @@ public interface IIndexerSetupReturnWhenBuilder
: IIndexerSetup
{
///
- /// Limits the return/throw to only execute for the given number of .
+ /// Repeats the return/throw for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -831,7 +839,8 @@ public interface IIndexerGetterSetup
/// Registers a callback to be invoked whenever the indexer's getter is accessed.
///
///
- /// The callback receives an incrementing access counter as first parameter, the parameters of the indexer and the value of the indexer as last parameter.
+ /// The callback receives an incrementing access counter as first parameter, the parameters of the indexer and the
+ /// value of the indexer as last parameter.
///
IIndexerSetupCallbackBuilder Do(Action callback);
}
@@ -867,7 +876,8 @@ public interface IIndexerSetterSetup
/// Registers a callback to be invoked whenever the indexer's setter is accessed.
///
///
- /// The callback receives an incrementing access counter as first parameter, the parameters of the indexer and the value the indexer is set to as last parameter.
+ /// The callback receives an incrementing access counter as first parameter, the parameters of the indexer and the
+ /// value the indexer is set to as last parameter.
///
IIndexerSetupCallbackBuilder Do(Action callback);
}
@@ -994,7 +1004,7 @@ public interface IIndexerSetupCallbackWhenBuilder
{
///
- /// Limits the callback to only execute for the given number of .
+ /// Repeats the callback for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -1039,7 +1049,7 @@ public interface IIndexerSetupReturnWhenBuilder
{
///
- /// Limits the return/throw to only execute for the given number of .
+ /// Repeats the return/throw for the given number of .
///
///
/// The number of times is only counted for actual executions (
diff --git a/Source/Mockolate/Setup/Interfaces.MethodSetup.cs b/Source/Mockolate/Setup/Interfaces.MethodSetup.cs
index a2a2e12c..c7c698af 100644
--- a/Source/Mockolate/Setup/Interfaces.MethodSetup.cs
+++ b/Source/Mockolate/Setup/Interfaces.MethodSetup.cs
@@ -138,7 +138,7 @@ public interface IReturnMethodSetupCallbackWhenBuilder
: IReturnMethodSetup
{
///
- /// Limits the callback to only execute for the given number of .
+ /// Repeats the callback for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -182,7 +182,7 @@ public interface IReturnMethodSetupReturnWhenBuilder
: IReturnMethodSetup
{
///
- /// Limits the return/throw to only execute for the given number of .
+ /// Repeats the return/throw for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -296,7 +296,7 @@ public interface IReturnMethodSetupCallbackWhenBuilder
: IReturnMethodSetup
{
///
- /// Limits the callback to only execute for the given number of .
+ /// Repeats the callback for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -340,7 +340,7 @@ public interface IReturnMethodSetupReturnWhenBuilder
: IReturnMethodSetup
{
///
- /// Limits the return/throw to only execute for the given number of .
+ /// Repeats the return/throw for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -454,7 +454,7 @@ public interface IReturnMethodSetupCallbackWhenBuilder
{
///
- /// Limits the callback to only execute for the given number of .
+ /// Repeats the callback for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -498,7 +498,7 @@ public interface IReturnMethodSetupReturnWhenBuilder
: IReturnMethodSetup
{
///
- /// Limits the return/throw to only execute for the given number of .
+ /// Repeats the return/throw for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -612,7 +612,7 @@ public interface IReturnMethodSetupCallbackWhenBuilder
{
///
- /// Limits the callback to only execute for the given number of .
+ /// Repeats the callback for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -656,7 +656,7 @@ public interface IReturnMethodSetupReturnWhenBuilder
{
///
- /// Limits the return/throw to only execute for the given number of .
+ /// Repeats the return/throw for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -771,7 +771,7 @@ public interface IReturnMethodSetupCallbackWhenBuilder
{
///
- /// Limits the callback to only execute for the given number of .
+ /// Repeats the callback for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -815,7 +815,7 @@ public interface IReturnMethodSetupReturnWhenBuilder
{
///
- /// Limits the return/throw to only execute for the given number of .
+ /// Repeats the return/throw for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -908,7 +908,7 @@ public interface IVoidMethodSetupCallbackBuilder : IVoidMethodSetupCallbackWhenB
public interface IVoidMethodSetupCallbackWhenBuilder : IVoidMethodSetup
{
///
- /// Limits the callback to only execute for the given number of .
+ /// Repeats the callback for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -948,7 +948,7 @@ public interface IVoidMethodSetupReturnBuilder : IVoidMethodSetupReturnWhenBuild
public interface IVoidMethodSetupReturnWhenBuilder : IVoidMethodSetup
{
///
- /// Limits the throw to only execute for the given number of .
+ /// Repeats the throw for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -1050,7 +1050,7 @@ public interface IVoidMethodSetupCallbackWhenBuilder
: IVoidMethodSetup
{
///
- /// Limits the callback to only execute for the given number of .
+ /// Repeats the callback for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -1092,7 +1092,7 @@ public interface IVoidMethodSetupReturnWhenBuilder
: IVoidMethodSetup
{
///
- /// Limits the throw to only execute for the given number of .
+ /// Repeats the throw for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -1194,7 +1194,7 @@ public interface IVoidMethodSetupCallbackWhenBuilder
: IVoidMethodSetup
{
///
- /// Limits the callback to only execute for the given number of .
+ /// Repeats the callback for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -1236,7 +1236,7 @@ public interface IVoidMethodSetupReturnWhenBuilder
: IVoidMethodSetup
{
///
- /// Limits the throw to only execute for the given number of .
+ /// Repeats the throw for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -1338,7 +1338,7 @@ public interface IVoidMethodSetupCallbackWhenBuilder
: IVoidMethodSetup
{
///
- /// Limits the callback to only execute for the given number of .
+ /// Repeats the callback for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -1380,7 +1380,7 @@ public interface IVoidMethodSetupReturnWhenBuilder
: IVoidMethodSetup
{
///
- /// Limits the throw to only execute for the given number of .
+ /// Repeats the throw for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -1482,7 +1482,7 @@ public interface IVoidMethodSetupCallbackWhenBuilder
{
///
- /// Limits the callback to only execute for the given number of .
+ /// Repeats the callback for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -1524,7 +1524,7 @@ public interface IVoidMethodSetupReturnWhenBuilder
{
///
- /// Limits the throw to only execute for the given number of .
+ /// Repeats the throw for the given number of .
///
///
/// The number of times is only counted for actual executions (
diff --git a/Source/Mockolate/Setup/Interfaces.PropertySetup.cs b/Source/Mockolate/Setup/Interfaces.PropertySetup.cs
index f4db83f0..8f5a45a2 100644
--- a/Source/Mockolate/Setup/Interfaces.PropertySetup.cs
+++ b/Source/Mockolate/Setup/Interfaces.PropertySetup.cs
@@ -185,7 +185,7 @@ public interface IPropertySetupCallbackBuilder : IPropertySetupWhenBuilder
public interface IPropertySetupWhenBuilder : IPropertySetup
{
///
- /// Limits the callback to only execute for the given number of .
+ /// Repeats the callback for the given number of .
///
///
/// The number of times is only counted for actual executions (
@@ -223,7 +223,7 @@ public interface IPropertySetupReturnBuilder : IPropertySetupReturnWhenBuilde
public interface IPropertySetupReturnWhenBuilder : IPropertySetup
{
///
- /// Limits the return/throw to only execute for the given number of .
+ /// Repeats the return/throw for the given number of .
///
///
/// The number of times is only counted for actual executions (
diff --git a/Source/Mockolate/Setup/PropertySetup.cs b/Source/Mockolate/Setup/PropertySetup.cs
index f769eda2..093e165e 100644
--- a/Source/Mockolate/Setup/PropertySetup.cs
+++ b/Source/Mockolate/Setup/PropertySetup.cs
@@ -156,7 +156,7 @@ IPropertySetupWhenBuilder IPropertySetupCallbackBuilder.InParallel()
///
IPropertySetupWhenBuilder IPropertySetupWhenBuilder.For(int times)
{
- _currentCallback?.For(x => x < times);
+ _currentCallback?.For(times);
return this;
}
@@ -177,7 +177,7 @@ IPropertySetupReturnWhenBuilder IPropertySetupReturnBuilder.When(Func
IPropertySetupReturnWhenBuilder IPropertySetupReturnWhenBuilder.For(int times)
{
- _currentReturnCallback?.For(x => x < times);
+ _currentReturnCallback?.For(times);
return this;
}
diff --git a/Source/Mockolate/Setup/ReturnMethodSetup.cs b/Source/Mockolate/Setup/ReturnMethodSetup.cs
index 406af198..a64b3186 100644
--- a/Source/Mockolate/Setup/ReturnMethodSetup.cs
+++ b/Source/Mockolate/Setup/ReturnMethodSetup.cs
@@ -123,7 +123,7 @@ IReturnMethodSetupCallbackWhenBuilder IReturnMethodSetupCallbackBuilder
///
IReturnMethodSetupCallbackWhenBuilder IReturnMethodSetupCallbackWhenBuilder.For(int times)
{
- _currentCallback?.For(x => x < times);
+ _currentCallback?.For(times);
return this;
}
@@ -146,7 +146,7 @@ IReturnMethodSetupReturnWhenBuilder IReturnMethodSetupReturnBuilder
IReturnMethodSetupReturnWhenBuilder IReturnMethodSetupReturnWhenBuilder.For(int times)
{
- _currentReturnCallback?.For(x => x < times);
+ _currentReturnCallback?.For(times);
return this;
}
@@ -164,7 +164,7 @@ protected override void ExecuteCallback(MethodInvocation invocation, MockBehavio
int currentCallbacksIndex = _currentCallbacksIndex;
for (int i = 0; i < _callbacks.Count; i++)
{
- Callback>? callback =
+ Callback> callback =
_callbacks[(currentCallbacksIndex + i) % _callbacks.Count];
if (callback.Invoke(wasInvoked, ref _currentCallbacksIndex, (invocationCount, @delegate)
=> @delegate(invocationCount)))
@@ -401,7 +401,7 @@ IReturnMethodSetupCallbackWhenBuilder IReturnMethodSetupCallbackBui
///
IReturnMethodSetupCallbackWhenBuilder IReturnMethodSetupCallbackWhenBuilder.For(int times)
{
- _currentCallback?.For(x => x < times);
+ _currentCallback?.For(times);
return this;
}
@@ -423,7 +423,7 @@ IReturnMethodSetupReturnWhenBuilder IReturnMethodSetupReturnBuilder
///
IReturnMethodSetupReturnWhenBuilder IReturnMethodSetupReturnWhenBuilder.For(int times)
{
- _currentReturnCallback?.For(x => x < times);
+ _currentReturnCallback?.For(times);
return this;
}
@@ -443,7 +443,7 @@ protected override void ExecuteCallback(MethodInvocation invocation, MockBehavio
int currentCallbacksIndex = _currentCallbacksIndex;
for (int i = 0; i < _callbacks.Count; i++)
{
- Callback>? callback =
+ Callback> callback =
_callbacks[(currentCallbacksIndex + i) % _callbacks.Count];
if (callback.Invoke(wasInvoked, ref _currentCallbacksIndex, (invocationCount, @delegate)
=> @delegate(invocationCount, p1)))
@@ -715,7 +715,7 @@ IReturnMethodSetupCallbackWhenBuilder IReturnMethodSetupCallbac
IReturnMethodSetupCallbackWhenBuilder IReturnMethodSetupCallbackWhenBuilder.
For(int times)
{
- _currentCallback?.For(x => x < times);
+ _currentCallback?.For(times);
return this;
}
@@ -738,7 +738,7 @@ IReturnMethodSetupReturnWhenBuilder IReturnMethodSetupReturnBui
IReturnMethodSetupReturnWhenBuilder IReturnMethodSetupReturnWhenBuilder.
For(int times)
{
- _currentReturnCallback?.For(x => x < times);
+ _currentReturnCallback?.For(times);
return this;
}
@@ -759,7 +759,7 @@ protected override void ExecuteCallback(MethodInvocation invocation, MockBehavio
int currentCallbacksIndex = _currentCallbacksIndex;
for (int i = 0; i < _callbacks.Count; i++)
{
- Callback>? callback =
+ Callback> callback =
_callbacks[(currentCallbacksIndex + i) % _callbacks.Count];
if (callback.Invoke(wasInvoked, ref _currentCallbacksIndex, (invocationCount, @delegate)
=> @delegate(invocationCount, p1, p2)))
@@ -1045,7 +1045,7 @@ IReturnMethodSetupCallbackWhenBuilder IReturnMethodSetupCal
IReturnMethodSetupCallbackWhenBuilder
IReturnMethodSetupCallbackWhenBuilder.For(int times)
{
- _currentCallback?.For(x => x < times);
+ _currentCallback?.For(times);
return this;
}
@@ -1068,7 +1068,7 @@ IReturnMethodSetupReturnWhenBuilder IReturnMethodSetupRetur
IReturnMethodSetupReturnWhenBuilder IReturnMethodSetupReturnWhenBuilder.
For(int times)
{
- _currentReturnCallback?.For(x => x < times);
+ _currentReturnCallback?.For(times);
return this;
}
@@ -1090,7 +1090,7 @@ protected override void ExecuteCallback(MethodInvocation invocation, MockBehavio
int currentCallbacksIndex = _currentCallbacksIndex;
for (int i = 0; i < _callbacks.Count; i++)
{
- Callback>? callback =
+ Callback> callback =
_callbacks[(currentCallbacksIndex + i) % _callbacks.Count];
if (callback.Invoke(wasInvoked, ref _currentCallbacksIndex, (invocationCount, @delegate)
=> @delegate(invocationCount, p1, p2, p3)))
@@ -1389,7 +1389,7 @@ public IReturnMethodSetupReturnBuilder Throws(Func.
For(int times)
{
- _currentCallback?.For(x => x < times);
+ _currentCallback?.For(times);
return this;
}
@@ -1415,7 +1415,7 @@ IReturnMethodSetup IReturnMethodSetupCallbackWhenBuilde
IReturnMethodSetupReturnWhenBuilder.
For(int times)
{
- _currentReturnCallback?.For(x => x < times);
+ _currentReturnCallback?.For(times);
return this;
}
@@ -1439,7 +1439,7 @@ protected override void ExecuteCallback(MethodInvocation invocation, MockBehavio
int currentCallbacksIndex = _currentCallbacksIndex;
for (int i = 0; i < _callbacks.Count; i++)
{
- Callback>? callback =
+ Callback> callback =
_callbacks[(currentCallbacksIndex + i) % _callbacks.Count];
if (callback.Invoke(wasInvoked, ref _currentCallbacksIndex, (invocationCount, @delegate)
=> @delegate(invocationCount, p1, p2, p3, p4)))
diff --git a/Source/Mockolate/Setup/VoidMethodSetup.cs b/Source/Mockolate/Setup/VoidMethodSetup.cs
index 24b6c600..d54195b2 100644
--- a/Source/Mockolate/Setup/VoidMethodSetup.cs
+++ b/Source/Mockolate/Setup/VoidMethodSetup.cs
@@ -115,7 +115,7 @@ IVoidMethodSetupCallbackWhenBuilder IVoidMethodSetupCallbackBuilder.When(Func
IVoidMethodSetupCallbackWhenBuilder IVoidMethodSetupCallbackWhenBuilder.For(int times)
{
- _currentCallback?.For(x => x < times);
+ _currentCallback?.For(times);
return this;
}
@@ -137,7 +137,7 @@ IVoidMethodSetupReturnWhenBuilder IVoidMethodSetupReturnBuilder.When(Func
IVoidMethodSetupReturnWhenBuilder IVoidMethodSetupReturnWhenBuilder.For(int times)
{
- _currentReturnCallback?.For(x => x < times);
+ _currentReturnCallback?.For(times);
return this;
}
@@ -155,7 +155,7 @@ protected override void ExecuteCallback(MethodInvocation invocation, MockBehavio
int currentCallbacksIndex = _currentCallbacksIndex;
for (int i = 0; i < _callbacks.Count; i++)
{
- Callback>? callback =
+ Callback> callback =
_callbacks[(currentCallbacksIndex + i) % _callbacks.Count];
if (callback.Invoke(wasInvoked, ref _currentCallbacksIndex, (invocationCount, @delegate)
=> @delegate(invocationCount)))
@@ -361,7 +361,7 @@ IVoidMethodSetupCallbackWhenBuilder IVoidMethodSetupCallbackBuilder.When
///
IVoidMethodSetupCallbackWhenBuilder IVoidMethodSetupCallbackWhenBuilder.For(int times)
{
- _currentCallback?.For(x => x < times);
+ _currentCallback?.For(times);
return this;
}
@@ -382,7 +382,7 @@ IVoidMethodSetupReturnWhenBuilder IVoidMethodSetupReturnBuilder.When(Fun
///
IVoidMethodSetupReturnWhenBuilder IVoidMethodSetupReturnWhenBuilder.For(int times)
{
- _currentReturnCallback?.For(x => x < times);
+ _currentReturnCallback?.For(times);
return this;
}
@@ -402,7 +402,7 @@ protected override void ExecuteCallback(MethodInvocation invocation, MockBehavio
int currentCallbacksIndex = _currentCallbacksIndex;
for (int i = 0; i < _callbacks.Count; i++)
{
- Callback>? callback =
+ Callback> callback =
_callbacks[(currentCallbacksIndex + i) % _callbacks.Count];
if (callback.Invoke(wasInvoked, ref _currentCallbacksIndex, (invocationCount, @delegate)
=> @delegate(invocationCount, p1)))
@@ -631,7 +631,7 @@ IVoidMethodSetupCallbackWhenBuilder IVoidMethodSetupCallbackBuilder
IVoidMethodSetupCallbackWhenBuilder IVoidMethodSetupCallbackWhenBuilder.For(int times)
{
- _currentCallback?.For(x => x < times);
+ _currentCallback?.For(times);
return this;
}
@@ -652,7 +652,7 @@ IVoidMethodSetupReturnWhenBuilder IVoidMethodSetupReturnBuilder.
///
IVoidMethodSetupReturnWhenBuilder IVoidMethodSetupReturnWhenBuilder.For(int times)
{
- _currentReturnCallback?.For(x => x < times);
+ _currentReturnCallback?.For(times);
return this;
}
@@ -673,7 +673,7 @@ protected override void ExecuteCallback(MethodInvocation invocation, MockBehavio
int currentCallbacksIndex = _currentCallbacksIndex;
for (int i = 0; i < _callbacks.Count; i++)
{
- Callback>? callback =
+ Callback> callback =
_callbacks[(currentCallbacksIndex + i) % _callbacks.Count];
if (callback.Invoke(wasInvoked, ref _currentCallbacksIndex, (invocationCount, @delegate)
=> @delegate(invocationCount, p1, p2)))
@@ -909,7 +909,7 @@ IVoidMethodSetupCallbackWhenBuilder IVoidMethodSetupCallbackBuilder<
///
IVoidMethodSetupCallbackWhenBuilder IVoidMethodSetupCallbackWhenBuilder.For(int times)
{
- _currentCallback?.For(x => x < times);
+ _currentCallback?.For(times);
return this;
}
@@ -931,7 +931,7 @@ IVoidMethodSetupReturnWhenBuilder IVoidMethodSetupReturnBuilder
IVoidMethodSetupReturnWhenBuilder IVoidMethodSetupReturnWhenBuilder.For(int times)
{
- _currentReturnCallback?.For(x => x < times);
+ _currentReturnCallback?.For(times);
return this;
}
@@ -953,7 +953,7 @@ protected override void ExecuteCallback(MethodInvocation invocation, MockBehavio
int currentCallbacksIndex = _currentCallbacksIndex;
for (int i = 0; i < _callbacks.Count; i++)
{
- Callback>? callback =
+ Callback> callback =
_callbacks[(currentCallbacksIndex + i) % _callbacks.Count];
if (callback.Invoke(wasInvoked, ref _currentCallbacksIndex, (invocationCount, @delegate)
=> @delegate(invocationCount, p1, p2, p3)))
@@ -1194,7 +1194,7 @@ IVoidMethodSetupCallbackWhenBuilder IVoidMethodSetupCallbackBuil
IVoidMethodSetupCallbackWhenBuilder IVoidMethodSetupCallbackWhenBuilder.
For(int times)
{
- _currentCallback?.For(x => x < times);
+ _currentCallback?.For(times);
return this;
}
@@ -1216,7 +1216,7 @@ IVoidMethodSetupReturnWhenBuilder IVoidMethodSetupReturnBuilder<
///
IVoidMethodSetupReturnWhenBuilder IVoidMethodSetupReturnWhenBuilder.For(int times)
{
- _currentReturnCallback?.For(x => x < times);
+ _currentReturnCallback?.For(times);
return this;
}
@@ -1239,7 +1239,7 @@ protected override void ExecuteCallback(MethodInvocation invocation, MockBehavio
int currentCallbacksIndex = _currentCallbacksIndex;
for (int i = 0; i < _callbacks.Count; i++)
{
- Callback>? callback =
+ Callback> callback =
_callbacks[(currentCallbacksIndex + i) % _callbacks.Count];
if (callback.Invoke(wasInvoked, ref _currentCallbacksIndex, (invocationCount, @delegate)
=> @delegate(invocationCount, p1, p2, p3, p4)))
diff --git a/Tests/Mockolate.Api.Tests/Expected/Mockolate_net10.0.txt b/Tests/Mockolate.Api.Tests/Expected/Mockolate_net10.0.txt
index 17de5ccb..b10ece70 100644
--- a/Tests/Mockolate.Api.Tests/Expected/Mockolate_net10.0.txt
+++ b/Tests/Mockolate.Api.Tests/Expected/Mockolate_net10.0.txt
@@ -575,7 +575,7 @@ namespace Mockolate.Setup
protected bool RunInParallel { get; }
protected bool CheckInvocations(int invocationCount) { }
protected bool CheckMatching(int matchingCount) { }
- public void For(System.Func predicate) { }
+ public void For(int times) { }
public void InParallel() { }
protected bool IsActive(int matchingCount) { }
public void Only(int times) { }
diff --git a/Tests/Mockolate.Api.Tests/Expected/Mockolate_net8.0.txt b/Tests/Mockolate.Api.Tests/Expected/Mockolate_net8.0.txt
index 469abd31..475544d9 100644
--- a/Tests/Mockolate.Api.Tests/Expected/Mockolate_net8.0.txt
+++ b/Tests/Mockolate.Api.Tests/Expected/Mockolate_net8.0.txt
@@ -574,7 +574,7 @@ namespace Mockolate.Setup
protected bool RunInParallel { get; }
protected bool CheckInvocations(int invocationCount) { }
protected bool CheckMatching(int matchingCount) { }
- public void For(System.Func predicate) { }
+ public void For(int times) { }
public void InParallel() { }
protected bool IsActive(int matchingCount) { }
public void Only(int times) { }
diff --git a/Tests/Mockolate.Api.Tests/Expected/Mockolate_netstandard2.0.txt b/Tests/Mockolate.Api.Tests/Expected/Mockolate_netstandard2.0.txt
index 101e888d..f8ba0821 100644
--- a/Tests/Mockolate.Api.Tests/Expected/Mockolate_netstandard2.0.txt
+++ b/Tests/Mockolate.Api.Tests/Expected/Mockolate_netstandard2.0.txt
@@ -551,7 +551,7 @@ namespace Mockolate.Setup
protected bool RunInParallel { get; }
protected bool CheckInvocations(int invocationCount) { }
protected bool CheckMatching(int matchingCount) { }
- public void For(System.Func predicate) { }
+ public void For(int times) { }
public void InParallel() { }
protected bool IsActive(int matchingCount) { }
public void Only(int times) { }