示例#1
0
        public void ToRedis_should_be_able_to_handle_list_of_Guids()
        {
            RedisMapper.RegisterType <CollectionOfGuidTestType2>();
            Assert.That(
                RedisMapper.TypesWithRegisteredProperties[typeof(CollectionOfGuidTestType2)],
                Has.One.Items);

            var subject = new CollectionOfGuidTestType2
            {
                GuidCollection = new List <Guid>
                {
                    Guid.Empty,
                    Guid.Parse("11c43ee8-b9d3-4e51-b73f-bd9dda66e29c")
                }
            };

            var result = RedisMapper.MapToRedisValues(subject);

            Assert.That(
                result["GuidCollection"],
                Is.EqualTo(
                    (RedisValue) $@"{
                            typeof(List<Guid>).AssemblyQualifiedName
                        }||00000000-0000-0000-0000-000000000000||11c43ee8-b9d3-4e51-b73f-bd9dda66e29c"));
        }
示例#2
0
        public void ToRedis_should_be_able_to_handle_an_empty_list_of_Guids()
        {
            RedisMapper.RegisterType <CollectionOfGuidTestType2>();
            Assert.That(
                RedisMapper.TypesWithRegisteredProperties[typeof(CollectionOfGuidTestType2)],
                Has.One.Items);

            var subject = new CollectionOfGuidTestType2
            {
                GuidCollection = new List <Guid>()
            };

            var result = RedisMapper.MapToRedisValues(subject);

            Assert.That(result["GuidCollection"],
                        Is.EqualTo((RedisValue)typeof(List <Guid>).AssemblyQualifiedName));
        }