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,

Currently I am having problems running test cases where I mock classes from third party libraries.


I can successfully mock basic tests such as the one below which assures me that TypeMock is running correctly:
   [TestFixture]
   public class StopLossStrategyManagerTests
   {
      [SetUp]
      public void Setup() 
      {
         // empty pre-test code that should be run
         MockManager.Init();
      }
      [TearDown]
      public void TearDown() 
      {
         // empty post-test code that should be run
         MockManager.Verify();
      }
      [Test]
      [ExpectedException(typeof(InvalidOperationException))]
      public void TestOne() 
      {
         throw new System.InvalidOperationException("Invalid op", null);
      }
   }

But the minute I try to write a Test Fixture such as the one below where the ICustomEntry interface is from a third party dll:
      [Test]
      public void GetPriceTestBuyBelowBid() 
      {
         Mock entryMock = MockManager.MockObject(typeof(ICustomEntry));
      }

I get the following error:

TestCase 'StopLoss.UnitTests.StopLossStrategyManagerTests.GetPriceTestBuyBelowBid'
failed: System.IO.FileLoadException : A procedure imported by 'TritonDotNetAPI' could not be loaded.
at StopLoss.UnitTests.StopLossStrategyManagerTests.GetPriceTestBuyBelowBid()


Any help would be appreciated.

Thanks
asked by phunk (640 points)

3 Answers

0 votes
Hi,

We are not sure what is the exact problem but it looks like a mismatching DLL's issue.
If possible please try to run the following tests and verify it is not failing on the added line:
     [Test] 
      public void GetPriceTestBuyBelowBid() 
      {
         ICustomEntry entry;
         Mock entryMock = MockManager.MockObject(typeof(ICustomEntry)); 
      }

If its still failing in the same place, and you can send us an example solution we will investigate the problem further. If not try activating our logs (using the Add-In under Visual Studio tab) and send us the generated log files.
answered by lior (13.2k points)
0 votes
I tried the suggested change and it still no luck. One of my peers who uses typemock was able to get it to work using the exact same project.

There seems to be no way to attach files to the forum. Whom do i send the logfile and sample project to?
answered by phunk (640 points)
0 votes
Lets take it offline
I'll send you a mail with the details.
answered by lior (13.2k points)
...