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
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
Hi, I am new to TypeMock and there is an issue that I can't seem to resolve. I'm unable to mock any of the .NET framework types, even the ones that aren't in mscorlib. The following code demonstrates the issue:

[TestMethod]
public void MyTestMethod()
{
    MockManager.Init();
    Mock<System.Net.Sockets.TcpClient> mock = MockManager.MockAll<System.Net.Sockets.TcpClient>();
    mock.ExpectConstructor(1);
    System.Net.Sockets.TcpClient foo = new System.Net.Sockets.TcpClient();
    MockManager.Verify();
}


The result is a VerifyException... "Method System.Net.Sockets.TcpClient..ctor() has 1 more expected calls." I have tried it with both Mock and MockAll. I have also tried it with a few other framework types, and with methods instead of constructors. Nothing seems to work. If I mock a simple type that I create (one that's not in the .NET framework), then everything works as expected.

Some more info... I'm using Visual Studio 2008, targeting either .NET 2.0 or 3.5. I'm running the tests using the built-in test runner.

I'd appreciate any help you can provide.

Thanks,
Jack
asked by jack.leitch (600 points)

1 Answer

0 votes
Hi,

The problem you are expereincing appears to be related to some issues we have with 2008.

We have created a temporary fix for that and i will send it to you offline.
answered by lior (13.2k points)
...