Skip to content

Not Considering Generic Parameter Types for Expectations #269

@JasonBock

Description

@JasonBock

If there is a method to mock defined like this:

public virtual void Set<T>() { ... }

And multiple expectations are set like this:

expectations.Methods.Set<string>();
expectations.Methods.Set<Guid>();

A cast exception will occur. This is because the gen'd code only looks at the 0th element in the methodHandlers array. Specifically, since there's no parameters, Rocks "thinks" there could only be one expectation set for it. It doesn't consider the generic parameter values as well. This should also be done if parameters are in play as well.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions