本文整理匯總了C#中MongoDB.Driver.MongoDBRef.GetHashCode方法的典型用法代碼示例。如果您正苦於以下問題:C# MongoDBRef.GetHashCode方法的具體用法?C# MongoDBRef.GetHashCode怎麽用?C# MongoDBRef.GetHashCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MongoDB.Driver.MongoDBRef
的用法示例。
在下文中一共展示了MongoDBRef.GetHashCode方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TestEqualsWithDatabase
public void TestEqualsWithDatabase()
{
var a1 = new MongoDBRef("d", "c", 1);
var a2 = new MongoDBRef("d", "c", 1);
var a3 = a2;
var b = new MongoDBRef("x", "c", 1);
var c = new MongoDBRef("d", "x", 1);
var d = new MongoDBRef("d", "c", 2);
var null1 = (MongoDBRef)null;
var null2 = (MongoDBRef)null;
Assert.AreNotSame(a1, a2);
Assert.AreSame(a2, a3);
Assert.IsTrue(a1.Equals((object)a2));
Assert.IsFalse(a1.Equals((object)null));
Assert.IsFalse(a1.Equals((object)"x"));
Assert.IsTrue(a1 == a2);
Assert.IsTrue(a2 == a3);
Assert.IsFalse(a1 == b);
Assert.IsFalse(a1 == c);
Assert.IsFalse(a1 == d);
Assert.IsFalse(a1 == null1);
Assert.IsFalse(null1 == a1);
Assert.IsTrue(null1 == null2);
Assert.IsFalse(a1 != a2);
Assert.IsFalse(a2 != a3);
Assert.IsTrue(a1 != b);
Assert.IsTrue(a1 != c);
Assert.IsTrue(a1 != d);
Assert.IsTrue(a1 != null1);
Assert.IsTrue(null1 != a1);
Assert.IsFalse(null1 != null2);
Assert.AreEqual(a1.GetHashCode(), a2.GetHashCode());
}