예제 #1
0
        public void GzJsonSerializer_List()
        {
            // arrange
            var serializer = new GzJsonCacheSerializer();
            var items      = new List <SerializerPoccoSerializable>()
            {
                SerializerPoccoSerializable.Create(),
                SerializerPoccoSerializable.Create(),
                SerializerPoccoSerializable.Create()
            };

            // act
            var data   = serializer.Serialize(items);
            var result = serializer.Deserialize(data, items.GetType());

            result.ShouldBeEquivalentTo(items);
        }
예제 #2
0
        public void Serializer_FullAddGet <T>(T cache)
            where T : ICacheManager <object>
        {
            using (cache)
            {
                // arrange
                var key   = Guid.NewGuid().ToString();
                var pocco = SerializerPoccoSerializable.Create();

                // act
                Func <bool> actSet = () => cache.Add(key, pocco);

                // assert
                actSet().Should().BeTrue("Should add the key");
                cache.Get <SerializerPoccoSerializable>(key).ShouldBeEquivalentTo(pocco);
            }
        }
예제 #3
0
        public void ProtoBufSerializer_FullAddGet()
        {
            using (var cache = TestManagers.CreateRedisCache(serializer: Serializer.Proto))
            {
                // arrange
                var key   = Guid.NewGuid().ToString();
                var pocco = SerializerPoccoSerializable.Create();

                // act
                Action actSet = () =>
                {
                    cache.Add(key, pocco);
                };

                // assert
                actSet.ShouldNotThrow();
                cache.Get <SerializerPoccoSerializable>(key).ShouldBeEquivalentTo(pocco);
            }
        }
예제 #4
0
        public void Serializer_FullAddGet <T>(T cache)
            where T : ICacheManager <object>
        {
            using (cache)
            {
                // arrange
                var key   = Guid.NewGuid().ToString();
                var pocco = SerializerPoccoSerializable.Create();

                // act
                Action actSet = () =>
                {
                    cache.Add(key, pocco);
                };

                // assert
                actSet.ShouldNotThrow();
                cache.Get <SerializerPoccoSerializable>(key).ShouldBeEquivalentTo(pocco);
            }
        }