本文整理汇总了C#中MongoDB.Driver.GridFS.MongoGridFSFileInfo.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# MongoGridFSFileInfo.Equals方法的具体用法?C# MongoGridFSFileInfo.Equals怎么用?C# MongoGridFSFileInfo.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MongoDB.Driver.GridFS.MongoGridFSFileInfo
的用法示例。
在下文中一共展示了MongoGridFSFileInfo.Equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestEquals
public void TestEquals()
{
var createOptions = new MongoGridFSCreateOptions { ChunkSize = 123 };
var a = new MongoGridFSFileInfo(gridFS, "f", createOptions);
var b = new MongoGridFSFileInfo(gridFS, "f", createOptions);
var c = new MongoGridFSFileInfo(gridFS, "g", createOptions);
var n = (MongoCredentials) null;
Assert.IsTrue(object.Equals(a, b));
Assert.IsFalse(object.Equals(a, c));
Assert.IsFalse(a.Equals(n));
Assert.IsFalse(a.Equals(null));
Assert.IsTrue(a == b);
Assert.IsFalse(a == c);
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 != null);
Assert.IsTrue(null != a);
Assert.IsFalse(n != null);
Assert.IsFalse(null != n);
}
示例2: TestEquals
public void TestEquals()
{
var createOptions = new MongoGridFSCreateOptions { ChunkSize = 123 };
var a1 = new MongoGridFSFileInfo(_gridFS, "f", createOptions);
var a2 = new MongoGridFSFileInfo(_gridFS, "f", createOptions);
var a3 = a2;
var b = new MongoGridFSFileInfo(_gridFS, "g", createOptions);
var null1 = (MongoGridFSFileInfo)null;
var null2 = (MongoGridFSFileInfo)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 == null1);
Assert.IsFalse(null1 == a1);
Assert.IsTrue(null1 == null2);
Assert.IsFalse(a1 != a2);
Assert.IsFalse(a2 != a3);
Assert.IsTrue(a1 != b);
Assert.IsTrue(a1 != null1);
Assert.IsTrue(null1 != a1);
Assert.IsFalse(null1 != null2);
Assert.AreEqual(a1.GetHashCode(), a2.GetHashCode());
}
示例3: TestEquals
public void TestEquals()
{
var settings = new MongoGridFSSettings();
var createOptions = new MongoGridFSCreateOptions { ChunkSize = 123 };
var a1 = new MongoGridFSFileInfo(_server, _server.Primary, _database.Name, settings, "f", createOptions);
var a2 = new MongoGridFSFileInfo(_server, _server.Primary, _database.Name, settings, "f", createOptions);
var a3 = a2;
var b = new MongoGridFSFileInfo(_server, _server.Primary, _database.Name, settings, "g", createOptions);
var null1 = (MongoGridFSFileInfo)null;
var null2 = (MongoGridFSFileInfo)null;
Assert.NotSame(a1, a2);
Assert.Same(a2, a3);
Assert.True(a1.Equals((object)a2));
Assert.False(a1.Equals((object)null));
Assert.False(a1.Equals((object)"x"));
Assert.True(a1 == a2);
Assert.True(a2 == a3);
Assert.False(a1 == b);
Assert.False(a1 == null1);
Assert.False(null1 == a1);
Assert.True(null1 == null2);
Assert.False(a1 != a2);
Assert.False(a2 != a3);
Assert.True(a1 != b);
Assert.True(a1 != null1);
Assert.True(null1 != a1);
Assert.False(null1 != null2);
Assert.Equal(a1.GetHashCode(), a2.GetHashCode());
}