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

  • Home
  • SEARCH
  • 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 838149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:15:22+00:00 2026-05-15T05:15:22+00:00

I create a MOQ object pass it to my class call it and pass

  • 0

I create a MOQ object

pass it to my class

call it and pass in an object.

How can I get access to this object to see if the right properties are set?

  • 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-15T05:15:22+00:00Added an answer on May 15, 2026 at 5:15 am

    If I’m reading your question correctly you seem to have a situation like this?

    public void DoTheCalculation(ICalculator calculator) {
       calculator.Calculate(this /* Or any other object */);
    }
    

    In which case you can assert upon the arguments passed to a Mocked interface using the It.Is method that accepts a predicate:

    [TestMethod]
    public void DoTheCalculation_DoesWhateverItShouldDo() {
         Mock<ICalculator> calcMock = new Mock<ICalculator>();
         CalculationParameters params = new CalculationParmeters(1, 2);
         params.DoTheCalculation(calcMock.Object);
    
         calcMock.Verify(c => c.Calculate(It.Is<CalculationParameters>(
                             c => c.LeftHandSide == 1 
                                  && c.RightHandSide == 2));
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on a wrapper for a COM object that can only
The code under test follows. view.QueryResultsGrid is a System.Windows.Forms.DataGridView object: public void SelectCheckedChanged(object sender,
I am getting started on the Moq framework and absolutely love it. I am
I am just getting involved in Moq and unit testing, so forgive me if
i've got the following Action Method I'm trying to moq test. Notice the AcceptVerbs
I'm trying to create a mock HttpContextBase for unit test. var fakePrinciple = new
Since I started to develop in a test/behavior driven style, I appreciated the ability
I'm new to Castle Windsor and am just using the latest version. I've created
The way I understand it, DI allows you to use an IoC container to

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.