Esempio n. 1
0
        public void ToRedis_should_be_able_to_handle_an_empty_collection_of_strings()
        {
            RedisMapper.RegisterType <CollectionOfStringsTestType1>();
            Assert.Equal(1, RedisMapper.RegisteredTypes[typeof(CollectionOfStringsTestType1)].Count);

            RedisMapper.RegisterType <CollectionOfStringsTestType2>();
            Assert.Equal(1, RedisMapper.RegisteredTypes[typeof(CollectionOfStringsTestType2)].Count);

            var subject = new CollectionOfStringsTestType2
            {
                StringCollection = new List <string>()
            };

            var result = subject.ToRedis();

            Assert.Equal($"{typeof(List<string>).AssemblyQualifiedName}", result[0].Value);
        }
Esempio n. 2
0
        public void ToRedis_should_be_able_to_handle_collection_of_strings()
        {
            RedisMapper.RegisterType <CollectionOfStringsTestType1>();
            Assert.Equal(1, RedisMapper.RegisteredTypes[typeof(CollectionOfStringsTestType1)].Count);

            RedisMapper.RegisterType <CollectionOfStringsTestType2>();
            Assert.Equal(1, RedisMapper.RegisteredTypes[typeof(CollectionOfStringsTestType2)].Count);

            var subject = new CollectionOfStringsTestType2
            {
                StringCollection = new List <string>
                {
                    "item1",
                    "item2",
                    "item3",
                    @"|item4"
                }
            };

            var result = subject.ToRedis();

            Assert.Equal($@"{typeof(List<string>).AssemblyQualifiedName}||item1||item2||item3||\|item4", result[0].Value);
        }