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 6193083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:03:27+00:00 2026-05-24T03:03:27+00:00

I have a situation where I need to mock a third-party interface and call

  • 0

I have a situation where I need to mock a third-party interface and call a third-party extension method that interacts with my component-under-test. It’s hard to figure out what exactly I need to verify on the mocked interface, and I’m wondering if it’s possible to trace whatever interactions Moq recorded so I can see what actually went on. From that, I am hoping to be able to code a meaningful expectation. I don’t see any evidence that this can be done in the API docs, but it seems like the technology is there and maybe is exposed somewhere that I haven’t found.

Thanks!

  • 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. Editorial Team
    Editorial Team
    2026-05-24T03:03:28+00:00Added an answer on May 24, 2026 at 3:03 am

    I don’t believe that such “playback” type functionality is available in Moq.

    However, a couple of techniques for determining the pattern of calls come to mind:

    • You could implement the interface with a very simple object, and then fire up your debugger and place breakpoints of all of the implemented methods and properties. That should enable you to map out what was called and with what values.

    • You could create a mock and set it use MockBehavior.Strict. The result of doing that will be that the Mock will throw an exception whenever any of it’s properties or methods are called (as long as there are no expectations set). You can catch these exceptions one by one and define expectations as you go, and slowly build up a picture of what’s being called.

    Neither scenario ideal, I admit.

    That being the case, have you considered whether this is the best place to mock the functionality? Could you instead introduce a layer of abstraction that hides all of the third party functionality, and mock that instead?

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

Sidebar

Related Questions

I have a situation where I need to unit test some scenarios that require
I have situation where I need to make sure that user has completed certain
I have a situation where I need to access an object that has been
I have this situation that I need to let users define decisions based on
I have a situation where I need to store some data that just won't
I have a situation where I need to mock some code in production. This
I have situation where I need to change the order of the columns/adding new
I have a situation where I need to be able to load assemblies in
I have a situation where I need to work with a datagrid and adding
I have a situation where i need to debug a Windows CE application in

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.