Skip to content

Callback functionality #39

@Tridy

Description

@Tridy

I would like to have the Callback functionality, like Moq does, for instance, so I could log or calculate the number of times a call with the certain command text was executed. What would be the best way of achieving that?

For example:

public int MyTableCalls { get; private set; }
...

dbConnecton.Mocks
    .When(cmd => cmd.CommandText.Contains("UPDATE MyTable") && cmd.Parameters.Count() == 1)
    .Callback(() => MyTableCalls++ )  // <<< this is what I would like to have
    .ReturnsScalar(1);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions