Hi im try to grant access to a private method with class generic type return but allway throw the same error. i put here and example only the structure as my code.
Alway send the error:
Alway send the error:
Argument Exception
Could not resolve the target method; make sure that you have provided arguments correctly.
Code:public interface IBase { } public abstract class BaseClass { } public class AssignedClass : BaseClass { } public class WrapperClass<T> : IBase where T : BaseClass, new() { } public class Control { private WrapperClass<AssignedClass> getWrapper() { return null; } } [TestClass] public class TestFlow { [TestMethod] public void ShouldWork() { var control = Mock.Create<Control>(); var wrapper = Mock.Create<WrapperClass<AssignedClass>>(); //Dosent Work Mock.NonPublic.Arrange<WrapperClass<AssignedClass>>(control, "getWrapper").Returns(wrapper); //Dosent Work Mock.NonPublic.Arrange<IBase>(control, "getWrapper").Returns(wrapper); } }