public void GlobalSetup()
 {
     _compoundKey = new CompoundKey
     {
         Integer = new Random(42).Next(),
         String  = Guid.NewGuid().ToString("N")
     };
     _compoundKeyObject    = _compoundKey;
     _compoundKeyCacheKeyA = _compoundKey;
     _compoundKeyCacheKeyB = _compoundKey;
     _integerObject        = _compoundKey.Integer;
     _integerCacheKeyA     = _compoundKey.Integer;
     _integerCacheKeyB     = _compoundKey.Integer;
     _stringObject         = _compoundKey.String;
     _stringCacheKeyA      = new CacheKeyA <CompoundKey>(_compoundKey.String);
     _stringCacheKeyB      = _compoundKey.String;
 }
Пример #2
0
        public bool Equals(CacheKeyA <TKey> other)
        {
            if (_keyType == other._keyType)
            {
                if (_keyType == CacheKeyType.PrimitiveKey)
                {
                    return(_primitiveKey.SequenceEqual(other._primitiveKey));
                }

                if (_keyType == CacheKeyType.ObjectKey)
                {
                    return(_objectKey.Equals(other._objectKey));
                }

                return(_originKey.Equals(other._originKey));
            }

            return(false);
        }