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
I'm currently running into an issue where I'm trying to test a WCF behavior that implement IErrorProvider. In the HandleError() method, the client has created a class that requires us to call a static method. So I'm trying to hook that method call via Fake.StaticMethods. However, I keep getting inconsistent behavior when I run the tests. I've created a project that I'd be more than willing to send to the TypeMock folks to demonstrate the issue.

Well, the sample project I created doesn't quite give the same problem. My tests in the sample project will succeed the first time, and then fail every time after that. In the "real" project code (that I can't ship to anyone) the test succeeds but VsTestHost.exe will crash with a System.ServiceModel.Diagnostics.CallbackException. But to make a long story short, there's a fair amount more going on in the "real" code than my test project, but I'm guessing by looking at the test project that might help out with the real issue.

Any help/ideas/WAGs would be appreciated :)

Thanks,
Jason
asked by jasonbock (1.2k points)

3 Answers

0 votes
Hi Jason,

I agree we should start by figuring out what's failing on your sample project; Can you send it to support at typemock.com?

Thanks!
Doron
Typemock Support
answered by doron (17.2k points)
0 votes
I just sent the zip file to the support e-mail - hopefully we can figure it out.

BTW I ran the Isolater Trace tool. The first time I run the test, I see that it hooks the static method. The 2nd time, it doesn't (for some odd reason).

Regards,
Jason
answered by jasonbock (1.2k points)
0 votes
This really had nothing to do with TypeMock. The mocked method was being called on another thread. The first time the test was run w/o VSTestHost being in memory, the race condition didn't occur. After that, it did. Using a ManualResetEvent fixed it.
answered by jasonbock (1.2k points)
...