Does MS Test provide a default value equals comparison?

Posted by fearofawhackplanet on Stack Overflow See other posts from Stack Overflow or by fearofawhackplanet
Published on 2010-06-06T10:12:37Z Indexed on 2010/06/06 10:22 UTC
Read the original article Hit count: 404

Filed under:
|
|
|
|

I want to test for example

int orderId = myRepository.SubmitOrder(orderA);

orderB = myRepository.GetOrder(orderId);

Assert.AreEqual(orderA, orderB); // fail

Obviously I need a value comparison here, but I don't want to have to provide an overridden Equals implementation for all of my classes purely for the sake of testing (it wouldn't be of any use in the rest of the app).

Is there a provided generic method that just checks every field using reflection? Or if not, it is possible to write my own?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET