public void StoreWithProtoTranscoder()
        {
            var config     = GetConfig();
            var transcoder = new ProtoBuf.Caching.Enyim.NetTranscoder();

            config.Transcoder = transcoder;
            SomeType obj = new SomeType {
                Id = 1, Name = "abc"
            }, clone;
            string cloneString;

            Assert.AreEqual(0, transcoder.Deserialized);
            Assert.AreEqual(0, transcoder.Serialized);
            using (var client = new MemcachedClient(config))
            {
                client.Store(StoreMode.Set, "raw1", obj);
                client.Store(StoreMode.Set, "raw2", "def");
            }
            Assert.AreEqual(0, transcoder.Deserialized);
            Assert.AreEqual(1, transcoder.Serialized);
            using (var client = new MemcachedClient(config))
            {
                clone       = (SomeType)client.Get("raw1");
                cloneString = (string)client.Get("raw2");
            }
            Assert.AreEqual(1, transcoder.Deserialized);
            Assert.AreEqual(1, transcoder.Serialized);

            Assert.AreEqual(1, clone.Id);
            Assert.AreEqual("abc", clone.Name);
            Assert.AreEqual("def", cloneString);
        }
        public void StoreWithProtoTranscoder()
        {
            var config = GetConfig();
            var transcoder = new ProtoBuf.Caching.Enyim.NetTranscoder();
            config.Transcoder =  transcoder;
            SomeType obj = new SomeType { Id = 1, Name = "abc" }, clone;
            string cloneString;
            Assert.AreEqual(0, transcoder.Deserialized);
            Assert.AreEqual(0, transcoder.Serialized);
            using (var client = new MemcachedClient(config))
            {
                client.Store(StoreMode.Set, "raw1", obj);
                client.Store(StoreMode.Set, "raw2", "def");
            }
            Assert.AreEqual(0, transcoder.Deserialized);
            Assert.AreEqual(1, transcoder.Serialized);
            using (var client = new MemcachedClient(config))
            {
                clone = (SomeType)client.Get("raw1");
                cloneString = (string)client.Get("raw2");
            }
            Assert.AreEqual(1, transcoder.Deserialized);
            Assert.AreEqual(1, transcoder.Serialized);

            Assert.AreEqual(1, clone.Id);
            Assert.AreEqual("abc", clone.Name);
            Assert.AreEqual("def", cloneString);
        }
        public void RoundTripList()
        {
            List <MyClass> myList = new List <MyClass> {
                new MyClass {
                    a = 1, b = 2
                },
                new MyClass {
                    a = 3, b = 4
                },
                new MyClass {
                    a = 5, b = 6
                }
            }, cloneList;
            var config     = GetConfig();
            var transcoder = new ProtoBuf.Caching.Enyim.NetTranscoder();

            config.Transcoder = transcoder;

            using (var client = new MemcachedClient(config))
            {
                client.Store(StoreMode.Set, "list1", myList);
            }

            using (var client = new MemcachedClient(config))
            {
                cloneList = (List <MyClass>)client.Get("list1");
            }
            Assert.AreEqual(3, cloneList.Count);
            Assert.AreEqual(1, cloneList[0].a);
            Assert.AreEqual(2, cloneList[0].b);
            Assert.AreEqual(3, cloneList[1].a);
            Assert.AreEqual(4, cloneList[1].b);
            Assert.AreEqual(5, cloneList[2].a);
            Assert.AreEqual(6, cloneList[2].b);
        }
        public void RoundTripList()
        {
            List<MyClass> myList = new List<MyClass> {
                new MyClass { a = 1, b = 2},
                new MyClass { a = 3, b = 4},
                new MyClass { a = 5, b = 6}
            }, cloneList;
            var config = GetConfig();
            var transcoder = new ProtoBuf.Caching.Enyim.NetTranscoder();
            config.Transcoder = transcoder;

            using (var client = new MemcachedClient(config))
            {
                client.Store(StoreMode.Set, "list1", myList);
            }

            using (var client = new MemcachedClient(config))
            {
                cloneList = (List<MyClass>)client.Get("list1");
            }
            Assert.AreEqual(3, cloneList.Count);
            Assert.AreEqual(1, cloneList[0].a);
            Assert.AreEqual(2, cloneList[0].b);
            Assert.AreEqual(3, cloneList[1].a);
            Assert.AreEqual(4, cloneList[1].b);
            Assert.AreEqual(5, cloneList[2].a);
            Assert.AreEqual(6, cloneList[2].b);
        }