Exemplo n.º 1
0
        public void ToRedis_should_be_able_to_handle_array_of_Guids()
        {
            RedisMapper.RegisterType <CollectionOfGuidTestType1>();
            Assert.That(
                RedisMapper.TypesWithRegisteredProperties[typeof(CollectionOfGuidTestType1)],
                Has.One.Items);

            var subject = new CollectionOfGuidTestType1
            {
                GuidCollection = new[]
                {
                    Guid.Empty,
                    Guid.Parse("11c43ee8-b9d3-4e51-b73f-bd9dda66e29c")
                }
            };

            var result = RedisMapper.MapToRedisValues(subject);

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

            var subject = new CollectionOfGuidTestType1
            {
                GuidCollection = new Guid[0]
            };

            var result = RedisMapper.MapToRedisValues(subject);

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