Skip to content

Possibility of adding Callback to ISetupSequentialAction #1541

@jflevesque-genetec

Description

@jflevesque-genetec

Hi,

I've had a situation where I need to raise a signal once a certain number of calls are made on a mock that has void return value.

My setup is as such:

        mock.SetupSequence(x => x.SendMessage(It.IsAny<Message>()))
            .Throws(new SomeException())
            .Throws(new SomeException())
            .Throws(new SomeException())
            .Pass(() => _tcs.SetResult()); // this does not compile

As it stands, the Pass operation does not take any argument, so we can't inject a callback to occur when that step happens.

Is this something that can be added to the Pass operation? Or would it be a new operation called Callback?

If it is not worth it, is there another approach that can be taken that would be cleaner than using a counter + switch in a standard Setup + Callback ?

Back this issue
Back this issue

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