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,

this is what I wanted:

using Excel = Microsoft.Office.Interop.Excel;
...
[Test]
public void MockExcel
{
  using (RecordExpectations recorder = RecorderManager.StartRecording())
   {
      Excel.ApplicationClass app = new Excel.ApplicationClass();
      app.Workbooks.Open(FileName, Type.Missing,Type.Missing, Type.Missing, Type.Missing,Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
//not mocked and starts Excel process
   }
}


Can I mock Excel interop not using wrappers ?
asked by Gmoorick (2.3k points)

1 Answer

0 votes
You guessed correctly.
TypeMock.NET does not mock interop code, it only mocks .NET code.
If the COM runs as .NET then it can be mocked but in your case it is not.

We will probably add this feature in the future.
answered by scott (32k points)
...