Esempio n. 1
0
        public void ConvertFromNull()
        {
            var sut = new PropertyExtractorCollectionConverter();

            sut.ConvertFrom(null)
            .Should().BeOfType <PropertyExtractorCollection.EmptyPropertyExtractorCollection>()
            .Which.Should().BeEmpty();
        }
Esempio n. 2
0
        public void ConvertTo()
        {
            var xml = $"<s0:Properties xmlns:s0=\"{SchemaAnnotation.NAMESPACE}\" xmlns:s1=\"urn\">"
                      + "<s1:Property1 xpath=\"*/some-node\" />"
                      + "<s1:Property2 mode=\"promote\" xpath=\"*/other-node\" />"
                      + "</s0:Properties>";

            var sut = new PropertyExtractorCollectionConverter();
            var extractorCollection = new PropertyExtractorCollection(
                new XPathExtractor(new XmlQualifiedName("Property1", "urn"), "*/some-node", ExtractionMode.Write),
                new XPathExtractor(new XmlQualifiedName("Property2", "urn"), "*/other-node", ExtractionMode.Promote));

            sut.ConvertTo(extractorCollection, typeof(string)).Should().Be(xml);
        }
Esempio n. 3
0
        public void ConvertFrom()
        {
            var xml = $@"<san:Properties xmlns:s0='urn' xmlns:san='{SchemaAnnotation.NAMESPACE}'>
  <s0:Property1 xpath='*/some-node'/>
  <s0:Property2 promoted='true' xpath='*/other-node'/>
</san:Properties>";

            var sut = new PropertyExtractorCollectionConverter();

            sut.ConvertFrom(xml)
            .Should().BeOfType <PropertyExtractorCollection>()
            .Which.Should().BeEquivalentTo(
                new XPathExtractor(new XmlQualifiedName("Property1", "urn"), "*/some-node", ExtractionMode.Write),
                new XPathExtractor(new XmlQualifiedName("Property2", "urn"), "*/other-node", ExtractionMode.Promote)
                );
        }
Esempio n. 4
0
        public void CanConvertTo()
        {
            var sut = new PropertyExtractorCollectionConverter();

            sut.CanConvertTo(typeof(string)).Should().BeTrue();
        }
Esempio n. 5
0
        public void ConvertToNull()
        {
            var sut = new PropertyExtractorCollectionConverter();

            sut.ConvertTo(new PropertyExtractorCollection(), typeof(string)).Should().BeNull();
        }