public void TestBsonTimestampEquals() { BsonTimestamp lhs = new BsonTimestamp(1L); BsonTimestamp rhs = new BsonTimestamp(1L); Assert.NotSame(lhs, rhs); Assert.Equal(lhs, rhs); Assert.Equal(lhs.GetHashCode(), rhs.GetHashCode()); }
public void Equals_should_return_false_when_values_are_not_equal(long value1, long value2) { var subject = new BsonTimestamp(value1); var other = new BsonTimestamp(value2); var result1 = subject.Equals(other); var result2 = subject.Equals((object)other); var subjectHashCode = subject.GetHashCode(); var otherHashCode = other.GetHashCode(); result1.Should().BeFalse(); result2.Should().BeFalse(); otherHashCode.Should().NotBe(subjectHashCode); }
public void Equals_should_return_true_when_values_are_equal(long value) { var subject = new BsonTimestamp(value); var other = new BsonTimestamp(value); other.Should().NotBeSameAs(subject); var result1 = subject.Equals(other); var result2 = subject.Equals((object)other); var subjectHashCode = subject.GetHashCode(); var otherHashCode = other.GetHashCode(); result1.Should().BeTrue(); result2.Should().BeTrue(); otherHashCode.Should().Be(subjectHashCode); }