public bool Equals(Adresse other) { if (ReferenceEquals(null, other)) { return false; } if (ReferenceEquals(this, other)) { return true; } return Equals(other.Ort, Ort) && Equals(other.Strasse, Strasse); }
public void Vergleichen_von_Strukturen() { var a1a = new Adresse { Strasse = "s1", Ort = "o1" }; var a1b = new Adresse { Strasse = "s1", Ort = "o1" }; var a2 = new Adresse { Strasse = "s2", Ort = "o2" }; Assert.That(a1a, Is.EqualTo(a1b)); // Komisch, oder? Assert.That(a1a, Is.Not.EqualTo(a2)); Equalidator.AreEqual(a1a, a1b); }