//------------------------------------------------------------------------- public virtual void test_equals() { ObjDoublePair <string> a = ObjDoublePair.of("1", 2.0d); ObjDoublePair <string> a2 = ObjDoublePair.of("1", 2.0d); ObjDoublePair <string> b = ObjDoublePair.of("1", 3.0d); ObjDoublePair <string> c = ObjDoublePair.of("2", 2.0d); ObjDoublePair <string> d = ObjDoublePair.of("2", 3.0d); assertEquals(a.Equals(a), true); assertEquals(a.Equals(b), false); assertEquals(a.Equals(c), false); assertEquals(a.Equals(d), false); assertEquals(a.Equals(a2), true); assertEquals(b.Equals(a), false); assertEquals(b.Equals(b), true); assertEquals(b.Equals(c), false); assertEquals(b.Equals(d), false); assertEquals(c.Equals(a), false); assertEquals(c.Equals(b), false); assertEquals(c.Equals(c), true); assertEquals(c.Equals(d), false); assertEquals(d.Equals(a), false); assertEquals(d.Equals(b), false); assertEquals(d.Equals(c), false); assertEquals(d.Equals(d), true); }
public virtual void test_equals_bad() { ObjDoublePair <string> a = ObjDoublePair.of("1", 1.7d); assertEquals(a.Equals(null), false); assertEquals(a.Equals(ANOTHER_TYPE), false); object unrelatedType = Pair.of(Convert.ToInt32(1), Convert.ToDouble(1.7d)); assertEquals(a.Equals(unrelatedType), false); }