Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 71813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:56:48+00:00 2026-05-10T19:56:48+00:00

I have an OLE COM object that trying to write a wrapper for, I

  • 0

I have an OLE COM object that trying to write a wrapper for, I have decided to start to use TDD to write the code for it as I believe that it will give me a better sense of direction with what I’m try to write. The COM object has a interface like this:

Interface Mapinfo     Sub [Do](ByVal cmd As String)     Function Eval(ByVal cmd As String) As String End Interface 

The [Do] command would take somthing like the following

Mapinfo.Do('OpenTable('''C:\Temp\MyTable.TAB''')') 

Now I am trying to write a wrapper so there is a function like this:

Mapinfo.OpenTable('C:\Temp\MyTable.TAB') 

Now my main problem that I’m having, is that every time I want to write a new test and some code I have to create an instance of the OLE object,wait for the application to start(30 secs+), test my little function,close and dispose OLE object, change code and run it all again.

My question is: Is there a better way to do all of this with out having to start the OLE app every time? I have heard about mock objects but haven’t really looked into it much, would they help me here? If so how?

EDIT: I have now realized that I will have to make a mock object for Mapinfo, my question is how do I make a make a mock object that can take different formated strings? How will this help me verify that the code in my wrapper is correct?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T19:56:49+00:00Added an answer on May 10, 2026 at 7:56 pm

    Yes, mock objects would help. Essentially, you create a fake Mapinfo object by mocking the Mapinfo interface (you should rename that IMapInfo, btw).

    You then instruct that mock what calls to expect, and what results to return (if appropriate). You can also create tests where the mock throws exceptions or does other things that are hard to invoke using the real object.

    The two big (and free) .NET mocking frameworks are MoQ and Rhino Mocks. Rhino is more mature and has more ways of configuring mocks. MoQ is the newcomer and has a smaller featureset and less ways of setting expectations than Rhino.

    Personally, I think MoQ is better for the newcomer to mocking. Its relatively easy to understand, all the documentation out there is relevant to the current release (search for Rhino tutorials and you get junk from years ago that doesn’t apply anymore), and it performs well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any inherent problems with calling an ole object from tsql? I have
How do I make instances of and calls to COM components that have been
I have a small application which automates Microsoft Word via COM/OLE Automation. Unfortunately this
I have the following code (OLE = OptimisticLockException) ... public void outer() { try
Have you guys had any experiences (positive or negative) by placing your source code/solution
Have you used VS.NET Architect Edition's Application and System diagrams to start designing a
I have been having a prolonged encounter with the beast known as COM Interop...
I have a C# implementation of a C++ COM Interface. I have ported the
We have a Sql Server 2000 database application that needs to update our applications
I have a VB6 project that references COMSVCSLib and one of the methods makes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.