// private methods private int GetHashCodeHelper() { // see Effective Java by Joshua Bloch int hash = 17; hash = 37 * hash + connectionMode.GetHashCode(); hash = 37 * hash + connectTimeout.GetHashCode(); hash = 37 * hash + (defaultCredentials == null ? 0 : defaultCredentials.GetHashCode()); hash = 37 * hash + guidRepresentation.GetHashCode(); hash = 37 * hash + ipv6.GetHashCode(); hash = 37 * hash + maxConnectionIdleTime.GetHashCode(); hash = 37 * hash + maxConnectionLifeTime.GetHashCode(); hash = 37 * hash + maxConnectionPoolSize.GetHashCode(); hash = 37 * hash + minConnectionPoolSize.GetHashCode(); hash = 37 * hash + (replicaSetName == null ? 0 : replicaSetName.GetHashCode()); hash = 37 * hash + (safeMode == null ? 0 : safeMode.GetHashCode()); if (servers != null) { foreach (var server in servers) { hash = 37 * hash + server.GetHashCode(); } } hash = 37 * hash + slaveOk.GetHashCode(); hash = 37 * hash + socketTimeout.GetHashCode(); hash = 37 * hash + waitQueueSize.GetHashCode(); hash = 37 * hash + waitQueueTimeout.GetHashCode(); return(hash); }
/// <summary> /// Gets the hash code. /// </summary> /// <returns>The hash code.</returns> public override int GetHashCode() { if (_isFrozen) { return(_frozenHashCode); } // see Effective Java by Joshua Bloch int hash = 17; hash = 37 * hash + _connectionMode.GetHashCode(); hash = 37 * hash + _connectTimeout.GetHashCode(); hash = 37 * hash + _credentialsStore.GetHashCode(); hash = 37 * hash + (_defaultCredentials == null ? 0 : _defaultCredentials.GetHashCode()); hash = 37 * hash + _guidRepresentation.GetHashCode(); hash = 37 * hash + _ipv6.GetHashCode(); hash = 37 * hash + _maxConnectionIdleTime.GetHashCode(); hash = 37 * hash + _maxConnectionLifeTime.GetHashCode(); hash = 37 * hash + _maxConnectionPoolSize.GetHashCode(); hash = 37 * hash + _minConnectionPoolSize.GetHashCode(); hash = 37 * hash + (_replicaSetName == null ? 0 : _replicaSetName.GetHashCode()); hash = 37 * hash + (_safeMode == null ? 0 : _safeMode.GetHashCode()); if (_servers != null) { foreach (var server in _servers) { hash = 37 * hash + server.GetHashCode(); } } hash = 37 * hash + _slaveOk.GetHashCode(); hash = 37 * hash + _socketTimeout.GetHashCode(); hash = 37 * hash + _waitQueueSize.GetHashCode(); hash = 37 * hash + _waitQueueTimeout.GetHashCode(); return(hash); }
/// <summary> /// Gets the hash code. /// </summary> /// <returns>The hash code.</returns> public override int GetHashCode() { if (_isFrozen) { return _frozenHashCode; } // see Effective Java by Joshua Bloch int hash = 17; hash = 37 * hash + _connectionMode.GetHashCode(); hash = 37 * hash + _connectTimeout.GetHashCode(); hash = 37 * hash + _credentialsStore.GetHashCode(); hash = 37 * hash + ((_defaultCredentials == null) ? 0 : _defaultCredentials.GetHashCode()); hash = 37 * hash + _guidRepresentation.GetHashCode(); hash = 37 * hash + _ipv6.GetHashCode(); hash = 37 * hash + _maxConnectionIdleTime.GetHashCode(); hash = 37 * hash + _maxConnectionLifeTime.GetHashCode(); hash = 37 * hash + _maxConnectionPoolSize.GetHashCode(); hash = 37 * hash + _minConnectionPoolSize.GetHashCode(); hash = 37 * hash + _readPreference.GetHashCode(); hash = 37 * hash + ((_replicaSetName == null) ? 0 : _replicaSetName.GetHashCode()); hash = 37 * hash + _safeMode.GetHashCode(); hash = 37 * hash + _secondaryAcceptableLatency.GetHashCode(); foreach (var server in _servers) { hash = 37 * hash + server.GetHashCode(); } hash = 37 * hash + _socketTimeout.GetHashCode(); hash = 37 * hash + _useSsl.GetHashCode(); hash = 37 * hash + _verifySslCertificate.GetHashCode(); hash = 37 * hash + _waitQueueSize.GetHashCode(); hash = 37 * hash + _waitQueueTimeout.GetHashCode(); return hash; }
private int GetHashCodeHelper() { // see Effective Java by Joshua Bloch int hash = 17; hash = 37 * hash + ((databaseName == null) ? 0 : databaseName.GetHashCode()); hash = 37 * hash + ((credentials == null) ? 0 : credentials.GetHashCode()); hash = 37 * hash + ((safeMode == null) ? 0 : safeMode.GetHashCode()); hash = 37 * hash + slaveOk.GetHashCode(); return(hash); }
private int GetHashCodeHelper() { // see Effective Java by Joshua Bloch int hash = 17; hash = 37 * hash + ((collectionName == null) ? 0 : collectionName.GetHashCode()); hash = 37 * hash + assignIdOnInsert.GetHashCode(); hash = 37 * hash + ((defaultDocumentType == null) ? 0 : defaultDocumentType.GetHashCode()); hash = 37 * hash + ((safeMode == null) ? 0 : safeMode.GetHashCode()); hash = 37 * hash + slaveOk.GetHashCode(); return(hash); }
// private methods private int GetHashCodeHelper() { // see Effective Java by Joshua Bloch int hash = 17; hash = 37 * hash + ((_databaseName == null) ? 0 : _databaseName.GetHashCode()); hash = 37 * hash + ((_credentials == null) ? 0 : _credentials.GetHashCode()); hash = 37 * hash + _guidRepresentation.GetHashCode(); hash = 37 * hash + ((_safeMode == null) ? 0 : _safeMode.GetHashCode()); hash = 37 * hash + _slaveOk.GetHashCode(); return(hash); }
// private methods private int GetHashCodeHelper() { // see Effective Java by Joshua Bloch int hash = 17; hash = 37 * hash + ((_collectionName == null) ? 0 : _collectionName.GetHashCode()); hash = 37 * hash + _assignIdOnInsert.GetHashCode(); hash = 37 * hash + ((_defaultDocumentType == null) ? 0 : _defaultDocumentType.GetHashCode()); hash = 37 * hash + _guidRepresentation.GetHashCode(); hash = 37 * hash + ((_safeMode == null) ? 0 : _safeMode.GetHashCode()); hash = 37 * hash + _slaveOk.GetHashCode(); return(hash); }
/// <summary> /// Gets the hash code. /// </summary> /// <returns>The hash code.</returns> public override int GetHashCode() { if (_isFrozen) { return(_frozenHashCode); } // see Effective Java by Joshua Bloch int hash = 17; hash = 37 * hash + _databaseName.GetHashCode(); hash = 37 * hash + ((_credentials != null) ? _credentials.GetHashCode() : 0); hash = 37 * hash + _guidRepresentation.GetHashCode(); hash = 37 * hash + _readPreference.GetHashCode(); hash = 37 * hash + _safeMode.GetHashCode(); return(hash); }
/// <summary> /// Gets the hash code. /// </summary> /// <returns>The hash code.</returns> public override int GetHashCode() { if (_isFrozen) { return(_frozenHashCode); } // see Effective Java by Joshua Bloch int hash = 17; hash = 37 * hash + ((_databaseName == null) ? 0 : _databaseName.GetHashCode()); hash = 37 * hash + ((_credentials == null) ? 0 : _credentials.GetHashCode()); hash = 37 * hash + _guidRepresentation.GetHashCode(); hash = 37 * hash + ((_safeMode == null) ? 0 : _safeMode.GetHashCode()); hash = 37 * hash + _slaveOk.GetHashCode(); return(hash); }
/// <summary> /// Gets the hash code. /// </summary> /// <returns>The hash code.</returns> public override int GetHashCode() { if (_isFrozen) { return(_frozenHashCode); } // see Effective Java by Joshua Bloch int hash = 17; hash = 37 * hash + _collectionName.GetHashCode(); hash = 37 * hash + _assignIdOnInsert.GetHashCode(); hash = 37 * hash + _defaultDocumentType.GetHashCode(); hash = 37 * hash + _guidRepresentation.GetHashCode(); hash = 37 * hash + _readPreference.GetHashCode(); hash = 37 * hash + _safeMode.GetHashCode(); return(hash); }
/// <summary> /// Gets the hash code. /// </summary> /// <returns>The hash code.</returns> public override int GetHashCode() { if (_isFrozen) { return(_frozenHashCode); } // see Effective Java by Joshua Bloch int hash = 17; hash = 37 * hash + ((_collectionName == null) ? 0 : _collectionName.GetHashCode()); hash = 37 * hash + _assignIdOnInsert.GetHashCode(); hash = 37 * hash + ((_defaultDocumentType == null) ? 0 : _defaultDocumentType.GetHashCode()); hash = 37 * hash + _guidRepresentation.GetHashCode(); hash = 37 * hash + ((_safeMode == null) ? 0 : _safeMode.GetHashCode()); hash = 37 * hash + _slaveOk.GetHashCode(); return(hash); }
public void TestEquals() { var a1 = new SafeMode(false); var a2 = new SafeMode(true) { Enabled = false }; var a3 = a2; var b = new SafeMode(false) { Enabled = true }; var c = new SafeMode(false) { FSync = true }; var d = new SafeMode(false) { J = true }; var e = new SafeMode(false) { W = 2 }; var f = new SafeMode(false) { WMode = "mode" }; var g = new SafeMode(false) { WTimeout = TimeSpan.FromMinutes(1) }; var null1 = (SafeMode)null; var null2 = (SafeMode)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 == e); Assert.IsFalse(a1 == f); Assert.IsFalse(a1 == g); 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 != e); Assert.IsTrue(a1 != f); Assert.IsTrue(a1 != g); Assert.IsTrue(a1 != null1); Assert.IsTrue(null1 != a1); Assert.IsFalse(null1 != null2); var hash = a1.GetHashCode(); Assert.AreEqual(hash, a2.GetHashCode()); // check that all tests still pass after objects are Frozen a1.Freeze(); a2.Freeze(); a3.Freeze(); b.Freeze(); c.Freeze(); d.Freeze(); e.Freeze(); f.Freeze(); g.Freeze(); 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 == e); Assert.IsFalse(a1 == f); Assert.IsFalse(a1 == g); 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 != e); Assert.IsTrue(a1 != f); Assert.IsTrue(a1 != g); Assert.IsTrue(a1 != null1); Assert.IsTrue(null1 != a1); Assert.IsFalse(null1 != null2); Assert.AreEqual(hash, a1.GetHashCode()); Assert.AreEqual(hash, a2.GetHashCode()); }