Esempio n. 1
0
        public void GivenRepeatingSimpleType_Map_ReturnsRepeating()
        {
            var uut = new TagToPropertyMapper(new SubPropertySetterFactory());

            uut.Map <TestTypeParent>();
            uut.TryGet(56.ToKnownTag(), typeof(TestTypeParent).GetHashCode(), out TagMapLeaf repeatingTag);
            uut.TryGet(57.ToKnownTag(), typeof(TestTypeParent).GetHashCode(), out TagMapLeaf actualTag);

            Assert.False(repeatingTag.IsEncoded);
            Assert.False(repeatingTag.IsEnumerable);
            Assert.NotNull(repeatingTag.Current);
            Assert.Null(repeatingTag.Parents);
            Assert.Null(repeatingTag.TypeConverterName);

            Assert.False(actualTag.IsEncoded);
            Assert.True(actualTag.IsEnumerable);
            Assert.NotNull(actualTag.Current);
            Assert.Null(actualTag.Parents);
            Assert.NotEqual(0, actualTag.RepeatingTagNumber);
        }
Esempio n. 2
0
        public void GivenSimpleTag_Map_ReturnsTagWithNoParents()
        {
            var uut = new TagToPropertyMapper(new SubPropertySetterFactory());

            uut.Map <TestTypeParent>();
            uut.TryGet(55.ToKnownTag(), typeof(TestTypeParent).GetHashCode(), out TagMapLeaf result);

            Assert.False(result.IsEncoded);
            Assert.False(result.IsEnumerable);
            Assert.NotNull(result.Current);
            Assert.Null(result.Parents);
        }
Esempio n. 3
0
        public void GivenComplexChildType_Map_ReturnsChildsTag()
        {
            var uut = new TagToPropertyMapper(new SubPropertySetterFactory());

            uut.Map <TestTypeParent>();
            uut.TryGet(58.ToKnownTag(), typeof(TestTypeParent).GetHashCode(), out TagMapLeaf result);

            Assert.False(result.IsEncoded);
            Assert.False(result.IsEnumerable);
            Assert.NotNull(result.Current);
            Assert.Single(result.Parents);
            Assert.False(result.Parents.First().IsEnumerable);
        }