public void TestBsonObjectIdEquals() { var a = new BsonObjectId(ObjectId.GenerateNewId()); var b = new BsonObjectId(a.Value); var c = new BsonObjectId(ObjectId.GenerateNewId()); var n = (BsonObjectId)null; Assert.IsTrue(object.Equals(a, b)); Assert.IsFalse(object.Equals(a, c)); Assert.IsFalse(object.Equals(a, BsonNull.Value)); Assert.IsFalse(a.Equals(n)); Assert.IsFalse(a.Equals(null)); Assert.IsTrue(a == b); Assert.IsFalse(a == c); Assert.IsFalse(a == BsonNull.Value); Assert.IsFalse(a == null); Assert.IsFalse(null == a); Assert.IsTrue(n == null); Assert.IsTrue(null == n); Assert.IsFalse(a != b); Assert.IsTrue(a != c); Assert.IsTrue(a != BsonNull.Value); Assert.IsTrue(a != null); Assert.IsTrue(null != a); Assert.IsFalse(n != null); Assert.IsFalse(null != n); }
public bool Equals(ModelForGenerated other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(BsonObjectIdValue.Equals(other.BsonObjectIdValue) && BooleanValue == other.BooleanValue && DoubleValue.Equals(other.DoubleValue) && StringValue == other.StringValue && BsonDocumentValue.Equals(other.BsonDocumentValue) && //DateTimeOffsetValue.Equals(other.DateTimeOffsetValue) && //GuidValue.Equals(other.GuidValue) && IntValue == other.IntValue && LongValue == other.LongValue && List.Equals(other.List)); }
public static bool IsNullOrEmpty(this BsonObjectId id) { return(id == null || id.Equals(BsonObjectId.Empty)); }
public override bool Equals(object obj) { return(BsonObjectId.Equals(obj)); }
public bool Equals(MongoObjectId other) { return(BsonObjectId.Equals(other.BsonObjectId)); }