Example #1
0
        public void Redis_ValueConverter_Poco_Update()
        {
            var cache = TestManagers.CreateRedisCache(17, false, Serializer.Json);

            // act/assert
            using (cache)
            {
                var key    = Guid.NewGuid().ToString();
                var region = Guid.NewGuid().ToString();
                var value  = new Poco()
                {
                    Id = 23, Something = "§asdad"
                };
                cache.Add(key, value, region);

                var newValue = new Poco()
                {
                    Id = 24, Something = "%!else$&"
                };
                object      resultValue = null;
                Func <bool> act         = () => cache.TryUpdate(key, region, (o) => newValue, out resultValue);

                act().Should().BeTrue();
                newValue.ShouldBeEquivalentTo(resultValue);
            }
        }
Example #2
0
        public void Redis_ValueConverter_CacheTypeConversion_Poco()
        {
            var cache = TestManagers.CreateRedisCache <Poco>(17, false, Serializer.Json);

            // act/assert
            using (cache)
            {
                var key   = Guid.NewGuid().ToString();
                var value = new Poco()
                {
                    Id = 23, Something = "§asdad"
                };
                cache.Add(key, value);
                var result = (Poco)cache.Get(key);
                value.ShouldBeEquivalentTo(result);
            }
        }