I have a silly question here. I define a class with many data members, like this:
public class A
{
public string Name { get; set; }
public double Score { get; set; }
//...many members
public C Direction { get; set; }
public List<B> NameValue1 { get; set; }
public List<string> NameValue2 { get; set; }
//...many members
}
Now, I'm writing unit test code and want to compare two instances of class A. But I found this doesn't work:
Assert.AreEquals(a1, a2);
I must override Equals
method to do that? C# can't help with this by default?
Or I can serialize these two guys and compare the filestream?
Thank you.