public void ReadXmlForExtractorPrecedence() { var xml = string.Format( "<Extractors>" + "<san:Properties precedence='schemaOnly' xmlns:s0='urn' xmlns:san='{0}'>" + "<s0:Property1 mode='clear'/>" + "</san:Properties>" + "</Extractors>", SchemaAnnotations.NAMESPACE); using (var reader = XmlReader.Create(new StringReader(xml))) { var sut = new PropertyExtractorCollectionSerializerSurrogate(new PropertyExtractorCollection()); sut.ReadXml(reader); Assert.That(sut.Precedence, Is.EqualTo(ExtractorPrecedence.SchemaOnly)); } }
public void WriteXmlForExtractorPrecedence() { var xml = string.Format( "<s0:Properties precedence=\"pipelineOnly\" xmlns:s0=\"{0}\" xmlns:s1=\"urn\">" + "<s1:Property1 xpath=\"*/some-node\" />" + "</s0:Properties>", SchemaAnnotations.NAMESPACE); var builder = new StringBuilder(); using (var writer = XmlWriter.Create(builder, new XmlWriterSettings { OmitXmlDeclaration = true })) { var sut = new PropertyExtractorCollectionSerializerSurrogate( new PropertyExtractorCollection( ExtractorPrecedence.PipelineOnly, new XPathExtractor(new XmlQualifiedName("Property1", "urn"), "*/some-node"))); sut.WriteXml(writer); } Assert.That(builder.ToString(), Is.EqualTo(xml)); }