Exemplo n.º 1
0
        public void PartitionKeySerialization_BinarySerializer()
        {
            Cache = new MemoryCache(new MemoryCacheSettings(), serializer: new BinarySerializer());

            Cache.AddStatic(StringItems[0], StringItems[1], StringItems[2]);
            var item = Cache.GetItem <string>(StringItems[0], StringItems[1]);

            Assert.IsNotNull(item);
            Assert.AreEqual(StringItems[0], item.Value.Partition);
            Assert.AreEqual(StringItems[1], item.Value.Key);
            Assert.AreEqual(StringItems[2], item.Value.Value);
        }
Exemplo n.º 2
0
        public void PartitionKeySerialization_BinarySerializer()
        {
            Cache = new MemoryCache(new MemoryCacheSettings(), serializer: new BinarySerializer());

            Cache.AddStatic(StringItems[0], StringItems[1], StringItems[2]);
            var item = Cache.GetItem<string>(StringItems[0], StringItems[1]);

            Assert.IsNotNull(item);
            Assert.AreEqual(StringItems[0], item.Value.Partition);
            Assert.AreEqual(StringItems[1], item.Value.Key);
            Assert.AreEqual(StringItems[2], item.Value.Value);
        }
Exemplo n.º 3
0
        public void Peek_ShouldThrowNotSupportedException()
        {
            var p = StringItems[0];
            var k = StringItems[1];
            var v = StringItems[2];

            Cache.AddStatic(p, k, v);
            Assert.Throws <NotSupportedException>(() => { Cache.Peek <string>(p, k); });
        }