public void ReadOnlyObjectEqualsSame() { var obj1 = new ReadOnlyObject(new Object()); var obj2 = obj1; Assert.IsTrue(obj1 == obj2); Assert.IsFalse(obj1 != obj2); Assert.IsTrue(obj1.Equals(obj2)); Assert.IsTrue(ReferenceEquals(obj1, obj2)); }
public void ReadOnlyObjectEqualsNull() { ReadOnlyObject obj = null; Assert.IsFalse(obj); Assert.IsTrue(obj == null); Assert.IsFalse(obj != null); Assert.IsTrue(ReferenceEquals(obj, null)); obj = new ReadOnlyObject(new Object()); // NOTE: This is Unity's intended implementation.. Assert.IsFalse(obj); Assert.IsTrue(obj == null); Assert.IsFalse(obj != null); Assert.IsTrue(obj.Equals(null)); Assert.IsFalse(ReferenceEquals(obj, null)); }