public void FastEqualsWorks() { var n1 = null as object; var n2 = null as object; var o1 = new object(); var o2 = new object(); var t1 = new EqualityTester { Id = 1 }; var t2 = new EqualityTester { Id = 1 }; var t3 = new EqualityTester { Id = 3 }; var s = "foo"; Assert.Equal(true, n1.FastEquals(null)); Assert.Equal(true, n1.FastEquals(n1)); Assert.Equal(true, n1.FastEquals(n2)); Assert.Equal(true, o1.FastEquals(o1)); Assert.Equal(true, t1.FastEquals(t1)); Assert.Equal(true, s.FastEquals(s)); Assert.Equal(false, o1.FastEquals(null)); Assert.Equal(false, o1.FastEquals(n1)); Assert.Equal(false, n1.FastEquals(o1)); Assert.Equal(false, s.FastEquals(o1)); Assert.Equal(false, t1.FastEquals(s)); Assert.Equal(null, o1.FastEquals(o2)); Assert.Equal(null, o1.FastEquals(s)); Assert.Equal(null, t1.FastEquals(t2)); Assert.Equal(null, t1.FastEquals(t3)); }
public void FastEqualsWorks() { var n1 = null as object; var n2 = null as object; var o1 = new object(); var o2 = new object(); var t1 = new EqualityTester { Id = 1 }; var t2 = new EqualityTester { Id = 1 }; var t3 = new EqualityTester { Id = 3 }; var s = "foo"; Assert.Equal(true, n1.FastEquals(null)); Assert.Equal(true, n1.FastEquals(n1)); Assert.Equal(true, n1.FastEquals(n2)); Assert.Equal(true, o1.FastEquals(o1)); Assert.Equal(true, t1.FastEquals(t1)); Assert.Equal(true, s.FastEquals(s)); Assert.Equal(false, o1.FastEquals(null)); Assert.Equal(false, o1.FastEquals(n1)); Assert.Equal(false, n1.FastEquals(o1)); Assert.Equal(false, s.FastEquals(o1)); Assert.Equal(false, t1.FastEquals(s)); Assert.Equal(null, o1.FastEquals(o2)); Assert.Equal(null, o1.FastEquals(s)); Assert.Equal(null, t1.FastEquals(t2)); Assert.Equal(null, t1.FastEquals(t3)); }