public void Equality() { var a = new TopicPartitionError("a", 31, ErrorCode.NoError); var a2 = new TopicPartitionError("a", 31, ErrorCode.NoError); var nes = new List <TopicPartitionError> { new TopicPartitionError("b", 31, ErrorCode.NoError), new TopicPartitionError("a", 32, ErrorCode.NoError), new TopicPartitionError("a", 31, ErrorCode.Local_Conflict), }; Assert.Equal(a, a2); Assert.True(a.Equals(a2)); Assert.True(a == a2); Assert.False(a != a2); foreach (var ne in nes) { Assert.NotEqual(a, ne); Assert.False(a.Equals(ne)); Assert.False(a == ne); Assert.True(a != ne); } }
public void NullEquality() { var tpe1 = new TopicPartitionError("a", 31, ErrorCode.NoError); TopicPartitionError tpe2 = null; TopicPartitionError tpe3 = null; Assert.NotEqual(tpe1, tpe2); Assert.False(tpe1.Equals(tpe2)); Assert.False(tpe1 == tpe2); Assert.True(tpe1 != tpe2); Assert.NotEqual(tpe2, tpe1); Assert.False(tpe2 == tpe1); Assert.True(tpe2 != tpe1); Assert.Equal(tpe2, tpe3); Assert.True(tpe2 == tpe3); Assert.False(tpe2 != tpe3); }