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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:21:24+00:00 2026-05-14T19:21:24+00:00

From MBUnit I am trying to check if the values of two objects are

  • 0

From MBUnit I am trying to check if the values of two objects are the same using

Assert.AreSame(RawDataRow, result);

However I am getting the following fail:

Expected Value & Actual Value : {RawDataRow: CentreID = "CentreID1",
CentreLearnerRef = "CentreLearnerRef1",
ContactID = 1, DOB = 2010-05-05T00:00:00.0000000,
Email = "Email1", ErrorCodes = "ErrorCodes1",
ErrorDescription = "ErrorDescription1", FirstName = "FirstName1"}

Remark : Both values look the same when formatted but they are distinct instances.

I don’t want to have to go through each property. Can I do this from MbUnit?

  • 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-14T19:21:24+00:00Added an answer on May 14, 2026 at 7:21 pm

    I’ve ended up building my own using Reflections

    private bool PropertiesEqual<T>(T object1, T object2)
            {
                PropertyDescriptorCollection object2Properties = TypeDescriptor.GetProperties(object1);
                foreach (PropertyDescriptor object1Property in TypeDescriptor.GetProperties(object2))
                {
                    PropertyDescriptor object2Property = object2Properties.Find(object1Property.Name, true);
    
                    if (object2Property != null)
                    {
                        object object1Value = object1Property.GetValue(object1);
                        object object2Value = object2Property.GetValue(object2);
    
                        if ((object1Value == null && object2Value != null) || (object1Value != null && object2Value == null))
                        {
                            return false;
                        }
    
                        if (object1Value != null && object2Value != null)
                        {
                            if (!object1Value.Equals(object2Value))
                            {
                                return false;
                            }
                        }
                    }
                }
                return true;
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our team is looking to switch from using mbunit to mstest, but there appears
I was reading about data driven testing using mbunit from this article. http://blog.benhall.me.uk/2007/04/mbunit-datafixture-data-driven-unit.html I
In our build process we're currently using MBUnit 2.x tests, called from an NAnt
From what information I could find, they both solve the same problems - more
I am trying to test the logic from some existing classes. It is not
I'm trying to call a function returning an interface from another unit; for instance
I am trying to use Gallio (v3.1)/MbUnit/NCover to run a unit test in my
I am trying to use DynamicTestFactory in MbUnit to generate test suites and test
I am looking at moving from NUnit to MbUnit for my unit testing framework
What distinguishes xUnit, nUnit,and mbUnit from each other? So far from what I can

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.