chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
Typemock Version:8.5

VS2015, c#

I am trying to verify that a non-public generic method is being called, but when I make the call to the method, how do I indicate the generic type?  This is an instance method, not static.
asked by jim.little (3.6k points)
[TestMethod]
public void Test_CallPrivateGeneric()
{
	var fakeCalculatorGeneric = Isolate.Fake.Instance<CalculatorGeneric<String>>();
	Isolate.Invoke.Method(fakeCalculatorGeneric, "DoSomethingPrivate");

	Isolate.Verify.NonPublic.WasCalled(fakeCalculatorGeneric, "DoSomethingPrivate");
}

public class CalculatorGeneric<T>
{
	public string DoSomething<T>(bool callMethod)
	{
		if (callMethod)
		{
			return DoSomethingPrivate<T>();
		}
		else
		{
			return "DidNotCalltheMethod";
		}
	}

	private string DoSomethingPrivate<T>()
	{
		return "foo";
	}
}

But when I ran this time, I saw this error:

TypeMock.TypeMockException : 
*** Could not invoke CalculatorGeneric`1.DoSomethingPrivate():
Currently Isolate.Invoke.Method() does not support generic methods
 
When will typemock support invoking generics and verify that generics are called?

 

 

Please log in or register to answer this question.

...