private static void compare_Value <T>(T t1, T t2, bool isSame) { var strong1 = new StrongType <T>(t1); var strong2 = new StrongType <T>(t2); if (strong1.Value != null) { Assert.AreEqual(isSame, strong1.Value.Equals(t2)); Assert.AreEqual(isSame, strong1.Value.Equals(strong2.Value)); } Assert.AreEqual(isSame, strong1.Equals(strong2.Value)); }
private static void compare_2_strong_types <T>(T t1, T t2, bool isSame) { var strong1 = new StrongType <T>(t1); var strong2 = new StrongType <T>(t2); // compare 2 strong types Assert.AreEqual(isSame, strong1.Equals(strong2)); Assert.AreEqual(isSame, strong1 == strong2); Assert.AreEqual(!isSame, strong1 != strong2); // compare 2 strong types, order reversed Assert.AreEqual(isSame, strong2.Equals(strong1)); Assert.AreEqual(isSame, strong2 == strong1); Assert.AreEqual(!isSame, strong2 != strong1); }
private static void compare_strong_type_to_value <T>(T t1, T t2, bool isSame) { var strong1 = new StrongType <T>(t1); var strong2 = new StrongType <T>(t2); // compare value (left) to strong type (right) Assert.AreEqual(isSame, t1 == strong2); Assert.AreEqual(!isSame, t1 != strong2); // compare strong type (left) to value (right) Assert.AreEqual(isSame, strong1.Equals(t2)); Assert.AreEqual(isSame, strong1 == t2); Assert.AreEqual(!isSame, strong1 != t2); }