Skip to content

Mock.VerifyAll() with no parameters passed in should throw ArgumentOutOfRangeException #1540

@jzabroski

Description

@jzabroski

This is something that bit me a long time ago when I first started using Moq. I thought Mock.VerifyAll() would just reference some global state to verify all mocks I had created.

moq/src/Moq/Mock.cs

Lines 127 to 133 in fb16d5e

public static void VerifyAll(params Mock[] mocks)
{
foreach (var mock in mocks)
{
mock.VerifyAll();
}
}

Alternatively, a static analysis rule in Roslyn could be used to warn when this happens.

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