Hi
I am currently evaluating whether to get TypeMock for our product or not.
One functionality that is important is the ability to stub and verifycalls on generic methods.
e.g.
private void MyFunction<T>() where T:SomeBaseClass{...}
When testing I found that this is possible:
[TestMethod]
...
myObj.ExpectAndReturn("MyFunction", "monkey");
...
myObj.Verify();
This will ignore the generic parameter on MyFunction and treat all instances the same way. However, I prefer to use the Arrange Act Assert syntax, rather than setting up expectations and verifying them.
I tried something like this, but it doesn't seem to work. Anyone know what I am doing wrong, or is it not possible?
[TestMethod]
...
Isolate.NonPublic.WhenCalled(myObject, "MyFunction").WillReturn("monkey");
...
Isolate.Verify.NonPublic.WasCalled(myObject, "MyFunction");
Thank you
/Kjell