private static void AssertSameSameDifferent(MenuItem item1, MenuItem item2, MenuItem item3) { var comparer = new MenuItemComparer(); Assert.That(comparer.Equals(item1, item2), Is.True); Assert.That(comparer.Equals(item1, item3), Is.False); Assert.That(comparer.Equals(item2, item3), Is.False); Assert.That(comparer.GetHashCode(item1), Is.EqualTo(comparer.GetHashCode(item2))); // - hash inequality isn't really guaranteed, now that you mention it //Assert.That(comparer.GetHashCode(item1), Is.Not.EqualTo(comparer.GetHashCode(item3))); //Assert.That(comparer.GetHashCode(item2), Is.Not.EqualTo(comparer.GetHashCode(item3))); }
private static void AssertSameSameSame(MenuItem item1, MenuItem item2, MenuItem item3) { var comparer = new MenuItemComparer(); Assert.That(comparer.Equals(item1, item2), Is.True); Assert.That(comparer.Equals(item1, item3), Is.True); Assert.That(comparer.Equals(item2, item3), Is.True); Assert.That(comparer.GetHashCode(item1), Is.EqualTo(comparer.GetHashCode(item2))); Assert.That(comparer.GetHashCode(item1), Is.EqualTo(comparer.GetHashCode(item3))); Assert.That(comparer.GetHashCode(item2), Is.EqualTo(comparer.GetHashCode(item3))); }