public void Wrong_Key_Add()
        {
            var g = _factory.GetGlobal();
            var p = _factory.GetOrCreatePartition("Matrix7");

            var globalKey          = new PartitionObjectKeyString(g.PartitionKey, "Yellow3");
            var partitionObjectKey = new PartitionObjectKeyString(p.PartitionKey, "Purple3");

            g.CreateEntry(globalKey, "Value").Is(true);
            p.CreateEntry(globalKey, "Value2").Is(false);

            g.CreateEntry(partitionObjectKey, "Value").Is(false);
            p.CreateEntry(partitionObjectKey, "Value2").Is(true);
        }
Example #2
0
        public void Wrong_Key_Add()
        {
            var factory = new TenantSpecificMemoizerFactory(NullLoggerFactory.Instance, _requestScope);

            var g = factory.GetGlobal();
            var p = factory.GetOrCreatePartition("Matrix7");

            var globalKey          = new PartitionObjectKeyString(g.PartitionKey, "Yellow3");
            var partitionObjectKey = new PartitionObjectKeyString(p.PartitionKey, "Purple3");

            g.CreateEntry(globalKey, "Value").Is(true);
            p.CreateEntry(globalKey, "Value2").Is(false);

            g.CreateEntry(partitionObjectKey, "Value").Is(false);
            p.CreateEntry(partitionObjectKey, "Value2").Is(true);
        }
        public void Wrong_Key_TryGetValue()
        {
            // Setup
            var g                  = _factory.GetGlobal();
            var p                  = _factory.GetOrCreatePartition("Matrix5");
            var globalKey          = new PartitionObjectKeyString(g.PartitionKey, "Yellow");
            var partitionObjectKey = new PartitionObjectKeyString(p.PartitionKey, "Purple");

            g.CreateEntry(globalKey, "Value").Is(true);
            p.CreateEntry(partitionObjectKey, "Value2").Is(true);

            // Cant get global cache key from Partition
            p.TryGetValue <string>(globalKey, out _).Is(false);
            g.TryGetValue <string>(globalKey, out _).Is(true);

            // Cant get partition key from global
            g.TryGetValue <string>(partitionObjectKey, out _).Is(false);
            p.TryGetValue <string>(partitionObjectKey, out _).Is(true);
        }
        public void Wrong_Key_Remove()
        {
            // Setup
            var g = _factory.GetGlobal();
            var p = _factory.GetOrCreatePartition("Matrix6");

            var globalKey          = new PartitionObjectKeyString(g.PartitionKey, "Yellow2");
            var partitionObjectKey = new PartitionObjectKeyString(p.PartitionKey, "Purple2");

            g.CreateEntry(globalKey, "Value").Is(true);
            p.CreateEntry(partitionObjectKey, "Value2").Is(true);

            // Cant remove global cache key from Partition
            g.Remove(globalKey).Is(true);
            p.Remove(globalKey).Is(false);

            // Cant remove partition key from global
            g.Remove(partitionObjectKey).Is(false);
            p.Remove(partitionObjectKey).Is(true);
        }
Example #5
0
        public void Wrong_Key_TryGetValue()
        {
            var factory = new TenantSpecificMemoizerFactory(NullLoggerFactory.Instance, _requestScope);
            // Setup
            var g                  = factory.GetGlobal();
            var p                  = factory.GetOrCreatePartition("Matrix5");
            var globalKey          = new PartitionObjectKeyString(g.PartitionKey, "Yellow");
            var partitionObjectKey = new PartitionObjectKeyString(p.PartitionKey, "Purple");

            g.CreateEntry(globalKey, "Value").Is(true);
            p.CreateEntry(partitionObjectKey, "Value2").Is(true);

            // Cant get global cache key from Partition
            p.TryGetValue <string>(globalKey, out _).Is(false);
            g.TryGetValue <string>(globalKey, out _).Is(true);

            // Cant get partition key from global
            g.TryGetValue <string>(partitionObjectKey, out _).Is(false);
            p.TryGetValue <string>(partitionObjectKey, out _).Is(true);
        }
        public void InvalidatePartitionDoesntAffectGlobal()
        {
            var g = _factory.GetGlobal();
            var p = _factory.GetOrCreatePartition("Matrix8");

            var globalKey          = new PartitionObjectKeyString(g.PartitionKey, "Yellow4");
            var partitionObjectKey = new PartitionObjectKeyString(p.PartitionKey, "Purple4");

            g.CreateEntry(globalKey, "Value").Is(true);
            p.CreateEntry(partitionObjectKey, "Value").Is(true);

            p.TryGetValue <string>(partitionObjectKey, out _).Is(true);
            g.TryGetValue <string>(globalKey, out _).Is(true);

            // Invalidate Partition only
            p.Invalidate();

            // Partition cache not found
            p.TryGetValue <string>(partitionObjectKey, out _).Is(false);
            // Global values still found
            g.TryGetValue <string>(globalKey, out _).Is(true);
        }
Example #7
0
        public void Wrong_Key_Remove()
        {
            var factory = new TenantSpecificMemoizerFactory(NullLoggerFactory.Instance, _requestScope);

            // Setup
            var g = factory.GetGlobal();
            var p = factory.GetOrCreatePartition("Matrix6");

            var globalKey          = new PartitionObjectKeyString(g.PartitionKey, "Yellow2");
            var partitionObjectKey = new PartitionObjectKeyString(p.PartitionKey, "Purple2");

            g.CreateEntry(globalKey, "Value").Is(true);
            p.CreateEntry(partitionObjectKey, "Value2").Is(true);

            // Cant remove global cache key from Partition
            g.Remove(globalKey).Is(true);
            p.Remove(globalKey).Is(false);

            // Cant remove partition key from global
            g.Remove(partitionObjectKey).Is(false);
            p.Remove(partitionObjectKey).Is(true);
        }