I have this C# class
public class EntryClass
{
public string Field { get; set; }
public List<FieldKeyValuePair<string, string>> FieldKeyValPairs { get; set; }
public bool Equals(EntryClass other)
{
return Field.Equals(other.Field)
&& FieldKeyValPairs.Equals(other.FieldKeyValPairs);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((EntryClass)obj);
}
}
public class FieldKeyValuePair<K, V>
{
public K Key { get; set; }
public V Value { get; set; }
public bool Equals(FieldKeyValuePair<K, V> other)
{
return Key.Equals(other.Key)
&& Value.Equals(other.Value);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((FieldKeyValuePair<K, V>)obj);
}
}
trying to do Assert.IsTrue(expected.SequenceEqual(actual));
always gives me false, I am seeing that even when expected and actual has same FieldKeyValPairs this expression always hits false && FieldKeyValPairs.Equals(other.FieldKeyValPairs);
EDIT And expected and Actual is of type
List<EntryClass> expected = new List<EntryClass>(); // TODO:
List<EntryClass> actual = new List<EntryClass>();