Exemplo n.º 1
1
 private void CheckNotSame(RedisValue x, RedisValue y)
 {
     Assert.IsFalse(Equals(x, y));
     Assert.IsFalse(x.Equals(y));
     Assert.IsFalse(y.Equals(x));
     Assert.IsFalse(x.GetHashCode() == y.GetHashCode()); // well, very unlikely
 }
Exemplo n.º 2
0
 private void CheckSame(RedisValue x, RedisValue y)
 {
     Assert.IsTrue(Equals(x, y));
     Assert.IsTrue(x.Equals(y));
     Assert.IsTrue(y.Equals(x));
     Assert.IsTrue(x.GetHashCode() == y.GetHashCode());
 }
Exemplo n.º 3
0
        private void CheckNotNull(RedisValue value)
        {
            Assert.IsFalse(value.IsNull);
            Assert.IsNotNull((byte[])value);
            Assert.IsNotNull((string)value);
            Assert.AreNotEqual(-1, value.GetHashCode());

            Assert.IsNotNull((string)value);
            Assert.IsNotNull((byte[])value);

            CheckSame(value, value);
            CheckNotSame(value, default(RedisValue));
            CheckNotSame(value, (string)null);
            CheckNotSame(value, (byte[])null);
        }
Exemplo n.º 4
0
        private void CheckNull(RedisValue value)
        {
            Assert.IsTrue(value.IsNull);
            Assert.IsTrue(value.IsNullOrEmpty);
            Assert.IsFalse(value.IsInteger);
            Assert.AreEqual(-1, value.GetHashCode());

            Assert.IsNull((string)value);
            Assert.IsNull((byte[])value);

            Assert.AreEqual(0, (int)value);
            Assert.AreEqual(0L, (long)value);

            CheckSame(value, value);
            CheckSame(value, default(RedisValue));
            CheckSame(value, (string)null);
            CheckSame(value, (byte[])null);
        }
 /// <summary>
 /// See Object.GetHashCode
 /// </summary>
 public override int GetHashCode() => RedisValue.GetHashCode(Value) + (IsPatternBased ? 1 : 0);