Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TUnit.Mocks.Benchmarks/CallbackBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public string TUnitMocks_CallbackWithArgs()
var lastMessage = "";
var mock = Mock.Of<ILogger>();
mock.Log(TUnitArg.Any<string>(), TUnitArg.Any<string>())
.Callback(args => lastMessage = (string)args[1]!);
.Callback((string _, string msg) => lastMessage = msg);

var logger = mock.Object;
logger.Log("INFO", "Test message 1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,6 @@ namespace TUnit.Mocks.Generated
/// <inheritdoc />
public IReadWriter_Write_M2_MockCall Callback(global::System.Action callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IReadWriter_Write_M2_MockCall Callback(global::System.Action<object?[]> callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IReadWriter_Write_M2_MockCall Throws(global::System.Func<object?[], global::System.Exception> exceptionFactory) { EnsureSetup().Throws(exceptionFactory); return this; }
/// <inheritdoc />
public IReadWriter_Write_M2_MockCall Raises(string eventName, object? args = null) { EnsureSetup().Raises(eventName, args); return this; }
/// <inheritdoc />
public IReadWriter_Write_M2_MockCall SetsOutParameter(int paramIndex, object? value) { EnsureSetup().SetsOutParameter(paramIndex, value); return this; }
/// <inheritdoc />
public IReadWriter_Write_M2_MockCall TransitionsTo(string stateName) { EnsureSetup().TransitionsTo(stateName); return this; }
/// <inheritdoc />
public IReadWriter_Write_M2_MockCall Then() { EnsureSetup().Then(); return this; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,6 @@ namespace TUnit.Mocks.Generated
/// <inheritdoc />
public IAsyncService_GetValueAsync_M0_MockCall Callback(global::System.Action callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IAsyncService_GetValueAsync_M0_MockCall Callback(global::System.Action<object?[]> callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IAsyncService_GetValueAsync_M0_MockCall Returns(global::System.Func<object?[], string> factory) { EnsureSetup().Returns(factory); return this; }
/// <inheritdoc />
public IAsyncService_GetValueAsync_M0_MockCall Throws(global::System.Func<object?[], global::System.Exception> exceptionFactory) { EnsureSetup().Throws(exceptionFactory); return this; }
/// <inheritdoc />
public IAsyncService_GetValueAsync_M0_MockCall Raises(string eventName, object? args = null) { EnsureSetup().Raises(eventName, args); return this; }
/// <inheritdoc />
public IAsyncService_GetValueAsync_M0_MockCall SetsOutParameter(int paramIndex, object? value) { EnsureSetup().SetsOutParameter(paramIndex, value); return this; }
/// <inheritdoc />
public IAsyncService_GetValueAsync_M0_MockCall TransitionsTo(string stateName) { EnsureSetup().TransitionsTo(stateName); return this; }
/// <inheritdoc />
public IAsyncService_GetValueAsync_M0_MockCall Then() { EnsureSetup().Then(); return this; }
Expand Down Expand Up @@ -311,14 +301,6 @@ namespace TUnit.Mocks.Generated
/// <inheritdoc />
public IAsyncService_DoWorkAsync_M1_MockCall Callback(global::System.Action callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IAsyncService_DoWorkAsync_M1_MockCall Callback(global::System.Action<object?[]> callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IAsyncService_DoWorkAsync_M1_MockCall Throws(global::System.Func<object?[], global::System.Exception> exceptionFactory) { EnsureSetup().Throws(exceptionFactory); return this; }
/// <inheritdoc />
public IAsyncService_DoWorkAsync_M1_MockCall Raises(string eventName, object? args = null) { EnsureSetup().Raises(eventName, args); return this; }
/// <inheritdoc />
public IAsyncService_DoWorkAsync_M1_MockCall SetsOutParameter(int paramIndex, object? value) { EnsureSetup().SetsOutParameter(paramIndex, value); return this; }
/// <inheritdoc />
public IAsyncService_DoWorkAsync_M1_MockCall TransitionsTo(string stateName) { EnsureSetup().TransitionsTo(stateName); return this; }
/// <inheritdoc />
public IAsyncService_DoWorkAsync_M1_MockCall Then() { EnsureSetup().Then(); return this; }
Expand Down Expand Up @@ -383,16 +365,6 @@ namespace TUnit.Mocks.Generated
/// <inheritdoc />
public IAsyncService_ComputeAsync_M2_MockCall Callback(global::System.Action callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IAsyncService_ComputeAsync_M2_MockCall Callback(global::System.Action<object?[]> callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IAsyncService_ComputeAsync_M2_MockCall Returns(global::System.Func<object?[], int> factory) { EnsureSetup().Returns(factory); return this; }
/// <inheritdoc />
public IAsyncService_ComputeAsync_M2_MockCall Throws(global::System.Func<object?[], global::System.Exception> exceptionFactory) { EnsureSetup().Throws(exceptionFactory); return this; }
/// <inheritdoc />
public IAsyncService_ComputeAsync_M2_MockCall Raises(string eventName, object? args = null) { EnsureSetup().Raises(eventName, args); return this; }
/// <inheritdoc />
public IAsyncService_ComputeAsync_M2_MockCall SetsOutParameter(int paramIndex, object? value) { EnsureSetup().SetsOutParameter(paramIndex, value); return this; }
/// <inheritdoc />
public IAsyncService_ComputeAsync_M2_MockCall TransitionsTo(string stateName) { EnsureSetup().TransitionsTo(stateName); return this; }
/// <inheritdoc />
public IAsyncService_ComputeAsync_M2_MockCall Then() { EnsureSetup().Then(); return this; }
Expand Down Expand Up @@ -477,14 +449,6 @@ namespace TUnit.Mocks.Generated
/// <inheritdoc />
public IAsyncService_InitializeAsync_M3_MockCall Callback(global::System.Action callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IAsyncService_InitializeAsync_M3_MockCall Callback(global::System.Action<object?[]> callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IAsyncService_InitializeAsync_M3_MockCall Throws(global::System.Func<object?[], global::System.Exception> exceptionFactory) { EnsureSetup().Throws(exceptionFactory); return this; }
/// <inheritdoc />
public IAsyncService_InitializeAsync_M3_MockCall Raises(string eventName, object? args = null) { EnsureSetup().Raises(eventName, args); return this; }
/// <inheritdoc />
public IAsyncService_InitializeAsync_M3_MockCall SetsOutParameter(int paramIndex, object? value) { EnsureSetup().SetsOutParameter(paramIndex, value); return this; }
/// <inheritdoc />
public IAsyncService_InitializeAsync_M3_MockCall TransitionsTo(string stateName) { EnsureSetup().TransitionsTo(stateName); return this; }
/// <inheritdoc />
public IAsyncService_InitializeAsync_M3_MockCall Then() { EnsureSetup().Then(); return this; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,6 @@ namespace TUnit.Mocks.Generated
/// <inheritdoc />
public INotifier_Notify_M0_MockCall Callback(global::System.Action callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public INotifier_Notify_M0_MockCall Callback(global::System.Action<object?[]> callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public INotifier_Notify_M0_MockCall Throws(global::System.Func<object?[], global::System.Exception> exceptionFactory) { EnsureSetup().Throws(exceptionFactory); return this; }
/// <inheritdoc />
public INotifier_Notify_M0_MockCall Raises(string eventName, object? args = null) { EnsureSetup().Raises(eventName, args); return this; }
/// <inheritdoc />
public INotifier_Notify_M0_MockCall SetsOutParameter(int paramIndex, object? value) { EnsureSetup().SetsOutParameter(paramIndex, value); return this; }
/// <inheritdoc />
public INotifier_Notify_M0_MockCall TransitionsTo(string stateName) { EnsureSetup().TransitionsTo(stateName); return this; }
/// <inheritdoc />
public INotifier_Notify_M0_MockCall Then() { EnsureSetup().Then(); return this; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,6 @@ namespace TUnit.Mocks.Generated
/// <inheritdoc />
public ITest_Test_M0_MockCall Callback(global::System.Action callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public ITest_Test_M0_MockCall Callback(global::System.Action<object?[]> callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public ITest_Test_M0_MockCall Throws(global::System.Func<object?[], global::System.Exception> exceptionFactory) { EnsureSetup().Throws(exceptionFactory); return this; }
/// <inheritdoc />
public ITest_Test_M0_MockCall Raises(string eventName, object? args = null) { EnsureSetup().Raises(eventName, args); return this; }
/// <inheritdoc />
public ITest_Test_M0_MockCall SetsOutParameter(int paramIndex, object? value) { EnsureSetup().SetsOutParameter(paramIndex, value); return this; }
/// <inheritdoc />
public ITest_Test_M0_MockCall TransitionsTo(string stateName) { EnsureSetup().TransitionsTo(stateName); return this; }
/// <inheritdoc />
public ITest_Test_M0_MockCall Then() { EnsureSetup().Then(); return this; }
Expand Down Expand Up @@ -231,16 +223,6 @@ namespace TUnit.Mocks.Generated
/// <inheritdoc />
public ITest_Get_M1_MockCall Callback(global::System.Action callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public ITest_Get_M1_MockCall Callback(global::System.Action<object?[]> callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public ITest_Get_M1_MockCall Returns(global::System.Func<object?[], string> factory) { EnsureSetup().Returns(factory); return this; }
/// <inheritdoc />
public ITest_Get_M1_MockCall Throws(global::System.Func<object?[], global::System.Exception> exceptionFactory) { EnsureSetup().Throws(exceptionFactory); return this; }
/// <inheritdoc />
public ITest_Get_M1_MockCall Raises(string eventName, object? args = null) { EnsureSetup().Raises(eventName, args); return this; }
/// <inheritdoc />
public ITest_Get_M1_MockCall SetsOutParameter(int paramIndex, object? value) { EnsureSetup().SetsOutParameter(paramIndex, value); return this; }
/// <inheritdoc />
public ITest_Get_M1_MockCall TransitionsTo(string stateName) { EnsureSetup().TransitionsTo(stateName); return this; }
/// <inheritdoc />
public ITest_Get_M1_MockCall Then() { EnsureSetup().Then(); return this; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,6 @@ namespace TUnit.Mocks.Generated
/// <inheritdoc />
public IService_GetAsync_M3_MockCall Callback(global::System.Action callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IService_GetAsync_M3_MockCall Callback(global::System.Action<object?[]> callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IService_GetAsync_M3_MockCall Returns(global::System.Func<object?[], string> factory) { EnsureSetup().Returns(factory); return this; }
/// <inheritdoc />
public IService_GetAsync_M3_MockCall Throws(global::System.Func<object?[], global::System.Exception> exceptionFactory) { EnsureSetup().Throws(exceptionFactory); return this; }
/// <inheritdoc />
public IService_GetAsync_M3_MockCall Raises(string eventName, object? args = null) { EnsureSetup().Raises(eventName, args); return this; }
/// <inheritdoc />
public IService_GetAsync_M3_MockCall SetsOutParameter(int paramIndex, object? value) { EnsureSetup().SetsOutParameter(paramIndex, value); return this; }
/// <inheritdoc />
public IService_GetAsync_M3_MockCall TransitionsTo(string stateName) { EnsureSetup().TransitionsTo(stateName); return this; }
/// <inheritdoc />
public IService_GetAsync_M3_MockCall Then() { EnsureSetup().Then(); return this; }
Expand Down Expand Up @@ -323,14 +313,6 @@ namespace TUnit.Mocks.Generated
/// <inheritdoc />
public IService_Process_M4_MockCall Callback(global::System.Action callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IService_Process_M4_MockCall Callback(global::System.Action<object?[]> callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IService_Process_M4_MockCall Throws(global::System.Func<object?[], global::System.Exception> exceptionFactory) { EnsureSetup().Throws(exceptionFactory); return this; }
/// <inheritdoc />
public IService_Process_M4_MockCall Raises(string eventName, object? args = null) { EnsureSetup().Raises(eventName, args); return this; }
/// <inheritdoc />
public IService_Process_M4_MockCall SetsOutParameter(int paramIndex, object? value) { EnsureSetup().SetsOutParameter(paramIndex, value); return this; }
/// <inheritdoc />
public IService_Process_M4_MockCall TransitionsTo(string stateName) { EnsureSetup().TransitionsTo(stateName); return this; }
/// <inheritdoc />
public IService_Process_M4_MockCall Then() { EnsureSetup().Then(); return this; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,6 @@ namespace TUnit.Mocks.Generated
/// <inheritdoc />
public IFoo_Bar_M0_MockCall Callback(global::System.Action callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IFoo_Bar_M0_MockCall Callback(global::System.Action<object?[]> callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IFoo_Bar_M0_MockCall Throws(global::System.Func<object?[], global::System.Exception> exceptionFactory) { EnsureSetup().Throws(exceptionFactory); return this; }
/// <inheritdoc />
public IFoo_Bar_M0_MockCall Raises(string eventName, object? args = null) { EnsureSetup().Raises(eventName, args); return this; }
/// <inheritdoc />
public IFoo_Bar_M0_MockCall SetsOutParameter(int paramIndex, object? value) { EnsureSetup().SetsOutParameter(paramIndex, value); return this; }
/// <inheritdoc />
public IFoo_Bar_M0_MockCall TransitionsTo(string stateName) { EnsureSetup().TransitionsTo(stateName); return this; }
/// <inheritdoc />
public IFoo_Bar_M0_MockCall Then() { EnsureSetup().Then(); return this; }
Expand Down Expand Up @@ -339,16 +331,6 @@ namespace TUnit.Mocks.Generated
/// <inheritdoc />
public IFoo_GetValue_M1_MockCall Callback(global::System.Action callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IFoo_GetValue_M1_MockCall Callback(global::System.Action<object?[]> callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IFoo_GetValue_M1_MockCall Returns(global::System.Func<object?[], string?> factory) { EnsureSetup().Returns(factory); return this; }
/// <inheritdoc />
public IFoo_GetValue_M1_MockCall Throws(global::System.Func<object?[], global::System.Exception> exceptionFactory) { EnsureSetup().Throws(exceptionFactory); return this; }
/// <inheritdoc />
public IFoo_GetValue_M1_MockCall Raises(string eventName, object? args = null) { EnsureSetup().Raises(eventName, args); return this; }
/// <inheritdoc />
public IFoo_GetValue_M1_MockCall SetsOutParameter(int paramIndex, object? value) { EnsureSetup().SetsOutParameter(paramIndex, value); return this; }
/// <inheritdoc />
public IFoo_GetValue_M1_MockCall TransitionsTo(string stateName) { EnsureSetup().TransitionsTo(stateName); return this; }
/// <inheritdoc />
public IFoo_GetValue_M1_MockCall Then() { EnsureSetup().Then(); return this; }
Expand Down Expand Up @@ -426,14 +408,6 @@ namespace TUnit.Mocks.Generated
/// <inheritdoc />
public IFoo_Process_M2_MockCall Callback(global::System.Action callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IFoo_Process_M2_MockCall Callback(global::System.Action<object?[]> callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IFoo_Process_M2_MockCall Throws(global::System.Func<object?[], global::System.Exception> exceptionFactory) { EnsureSetup().Throws(exceptionFactory); return this; }
/// <inheritdoc />
public IFoo_Process_M2_MockCall Raises(string eventName, object? args = null) { EnsureSetup().Raises(eventName, args); return this; }
/// <inheritdoc />
public IFoo_Process_M2_MockCall SetsOutParameter(int paramIndex, object? value) { EnsureSetup().SetsOutParameter(paramIndex, value); return this; }
/// <inheritdoc />
public IFoo_Process_M2_MockCall TransitionsTo(string stateName) { EnsureSetup().TransitionsTo(stateName); return this; }
/// <inheritdoc />
public IFoo_Process_M2_MockCall Then() { EnsureSetup().Then(); return this; }
Expand Down Expand Up @@ -507,16 +481,6 @@ namespace TUnit.Mocks.Generated
/// <inheritdoc />
public IFoo_GetAsync_M3_MockCall Callback(global::System.Action callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IFoo_GetAsync_M3_MockCall Callback(global::System.Action<object?[]> callback) { EnsureSetup().Callback(callback); return this; }
/// <inheritdoc />
public IFoo_GetAsync_M3_MockCall Returns(global::System.Func<object?[], string?> factory) { EnsureSetup().Returns(factory); return this; }
/// <inheritdoc />
public IFoo_GetAsync_M3_MockCall Throws(global::System.Func<object?[], global::System.Exception> exceptionFactory) { EnsureSetup().Throws(exceptionFactory); return this; }
/// <inheritdoc />
public IFoo_GetAsync_M3_MockCall Raises(string eventName, object? args = null) { EnsureSetup().Raises(eventName, args); return this; }
/// <inheritdoc />
public IFoo_GetAsync_M3_MockCall SetsOutParameter(int paramIndex, object? value) { EnsureSetup().SetsOutParameter(paramIndex, value); return this; }
/// <inheritdoc />
public IFoo_GetAsync_M3_MockCall TransitionsTo(string stateName) { EnsureSetup().TransitionsTo(stateName); return this; }
/// <inheritdoc />
public IFoo_GetAsync_M3_MockCall Then() { EnsureSetup().Then(); return this; }
Expand Down
Loading
Loading