Skip to content

Constraints are Not Carried to Extension Methods #179

@JasonBock

Description

@JasonBock

Code to reproduce this:

public class Thing { }

public abstract class Thing<T> : Thing where T : class
{
    public abstract Thing<TTarget> As<TTarget>() where TTarget : class;
}

var expectations = Rock.Create<Thing<object>>

This is because the As<TInterface> method has a constraint on it, but when the MethodExpectations<> extension method is made for As<TInterface>, the constraints aren't there. I need to copy the constraints from a member into the extension methods.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions