public void SetPropertyNullableDouble()
        {
            var xml       = EmbeddedResource.GetEmbeddedXml(GetType(), "Resources.responseWithArrays.xml");
            var fieldNode = xml.XPathSelectElement("response/result/doc/float[@name='price']");
            var mapper    = new AttributesMappingManager();
            var visitor   = new DefaultDocumentVisitor(mapper, new DefaultFieldParser());
            var doc       = new TestDocumentWithNullableDouble();

            visitor.Visit(doc, "price", fieldNode);
            Assert.AreEqual(92d, doc.Price);
        }
        public void SetPropertyWithArrayOfStrings()
        {
            var xml       = EmbeddedResource.GetEmbeddedXml(GetType(), "Resources.responseWithArrays.xml");
            var fieldNode = xml.XPathSelectElement("response/result/doc/arr[@name='cat']");
            var mapper    = new AttributesMappingManager();
            var visitor   = new DefaultDocumentVisitor(mapper, new DefaultFieldParser());
            var doc       = new TestDocumentWithArrays();

            visitor.Visit(doc, "cat", fieldNode);
            Assert.AreEqual(2, doc.Cat.Count);
            var cats = new List <string>(doc.Cat);

            Assert.AreEqual("electronics", cats[0]);
            Assert.AreEqual("hard drive", cats[1]);
        }
        public void SetPropertyWithArrayOfIntsToIntArray()
        {
            var xml       = EmbeddedResource.GetEmbeddedXml(GetType(), "Resources.responseWithArrays.xml");
            var fieldNode = xml.XPathSelectElement("response/result/doc/arr[@name='numbers']");
            var mapper    = new AttributesMappingManager();
            var visitor   = new DefaultDocumentVisitor(mapper, new DefaultFieldParser());
            var doc       = new TestDocumentWithArrays2();

            visitor.Visit(doc, "numbers", fieldNode);
            Assert.AreEqual(2, doc.Numbers.Length);
            var numbers = new List <int>(doc.Numbers);

            Assert.AreEqual(1, numbers[0]);
            Assert.AreEqual(2, numbers[1]);
        }