Moq.Dapper
Moq.Dapper copied to clipboard
Accessing the params argument in the ReturnsAsync
If I call a query with parameters is there currently anyway to access those values in the ReturnsAsync
method?
I need to access the data in my tests and store it for another query to use it.
Thanks
Hi @roly445, can you please provide some sample code? I am not sure I understand the scenario as it sounds like you could simply use a variable for constant values.
I'm running into this issue when trying to do something like this:
connection.SetupDapperAsync(c => c.QueryAsync<string>(It.IsAny<string>(), It.IsAny<object>(), null, null, CommandType.StoredProcedure))
.ReturnsAsync((string s, object o) => new []
{
SuccessfulCall(s, o)
});
public static string SuccessfulCall(string proc, obj param) => $"{proc} successfully called with param {JsonSerializer.Serialize(param)}!";
I've also run into this issue recently. Did either of you find what the issue was, or perhaps another way to achieve this, @roly445 @Dessyreqt?