public void Equality() { var timestamp1 = new Timestamp(123456789, TimestampType.CreateTime); var timestamp2 = new Timestamp(-123456789, TimestampType.LogAppendTime); var tpt1 = new TopicPartitionTimestamp("a", 31, timestamp1); var tpt2 = new TopicPartitionTimestamp("a", 31, timestamp1); var list = new List <TopicPartitionTimestamp> { new TopicPartitionTimestamp("b", 31, timestamp1), new TopicPartitionTimestamp("a", 32, timestamp1), new TopicPartitionTimestamp("a", 31, timestamp2), }; Assert.Equal(tpt1, tpt2); Assert.True(tpt1.Equals(tpt2)); Assert.True(tpt1 == tpt2); Assert.False(tpt1 != tpt2); foreach (var item in list) { Assert.NotEqual(tpt1, item); Assert.False(tpt1.Equals(item)); Assert.False(tpt1 == item); Assert.True(tpt1 != item); } }