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?
EDIT: As it seems people are kind of missing the point. I don't want to have to write my own comparison logic. That would require hundreds of lines of extra code. I'm looking for something like a generic
bool ContainSameValues<T>(T t1, T t2)
method which recursively uses reflection to pull out all the values in T.
FURTHER EDIT: Since it doesn't appear there is any built in support for doing something like this, you can see my (failed) attempt at writing my own here