Beispiel #1
0
        public void CollectionsOfSimpleValuesShouldBeMapped_EvenWhenThePropertyOnlyHasASetter()
        {
            var doc = new XmlDocument();
            doc.LoadXml(SIMPLE);

            var person = new ConfigMapper(doc.DocumentElement).GetObjectFromXml<SimplePersonWO>();
            var pets = person.GetPets();
            pets.Count.Should().Be(3);
            pets[0].Should().Be("scruffy");
            pets[1].Should().Be("scratchy");
            pets[2].Should().Be("tiddles");
        }
Beispiel #2
0
        public void CollectionsOfSimpleValuesShouldBeMapped_EvenWhenThePropertyOnlyHasASetter()
        {
            var doc = new XmlDocument();

            doc.LoadXml(SIMPLE);

            var person = new ConfigMapper(doc.DocumentElement).GetObjectFromXml <SimplePersonWO>();
            var pets   = person.GetPets();

            pets.Count.Should().Be(3);
            pets[0].Should().Be("scruffy");
            pets[1].Should().Be("scratchy");
            pets[2].Should().Be("tiddles");
        }
Beispiel #3
0
        public void CollectionsOfComplexValuesShouldBeMapped_EvenWhenThePropertyOnlyHasASetter()
        {
            var doc = new XmlDocument();

            doc.LoadXml(COMPLEX);

            var person = new ConfigMapper(doc.DocumentElement).GetObjectFromXml <ComplexPersonWO>();
            var pets   = person.GetPets();

            pets.Count.Should().Be(2);
            pets[0].Paws.Should().Be(4);
            pets[0].Name.Should().Be("Cuddles");
            pets[1].Paws.Should().Be(3);
            pets[1].Name.Should().Be("Tiddles");
        }
Beispiel #4
0
        public void CollectionsOfComplexValuesShouldBeMapped_EvenWhenThePropertyOnlyHasASetter()
        {
            var doc = new XmlDocument();
            doc.LoadXml(COMPLEX);

            var person = new ConfigMapper(doc.DocumentElement).GetObjectFromXml<ComplexPersonWO>();
            var pets = person.GetPets();
            pets.Count.Should().Be(2);
            pets[0].Paws.Should().Be(4);
            pets[0].Name.Should().Be("Cuddles");
            pets[1].Paws.Should().Be(3);
            pets[1].Name.Should().Be("Tiddles");
        }