public void TransformOneAggregateStreamDoesNotDiscardXmlDeclarationsAndThrows() { using (var stream1 = new StringStream("<?xml version='1.0' encoding='utf-16'?><root><one/></root>")) using (var stream2 = new StringStream("<?xml version='1.0' encoding='utf-16'?><root><two/></root>")) using (var stream6 = new StringStream("<?xml version='1.0' encoding='utf-16'?><root><six/></root>")) using (var compositeStream = new CompositeXmlStream(new System.IO.Stream[] { stream1, stream2, stream6 })) using (var memoryStream = new MemoryStream()) { compositeStream.CopyTo(memoryStream); Invoking(() => memoryStream.Rewind().Transform().Apply(typeof(IdentityTransform))).Should().Throw <XmlException>(); } }
public void TransformOneCompositeStreamDiscardsXmlDeclarations() { using (var stream1 = new StringStream("<?xml version='1.0' encoding='utf-16'?><root><one/></root>")) using (var stream2 = new StringStream("<?xml version='1.0' encoding='utf-16'?><root><two/></root>")) using (var stream6 = new StringStream("<?xml version='1.0' encoding='utf-16'?><root><six/></root>")) using (var compositeStream = new CompositeXmlStream(new System.IO.Stream[] { stream1, stream2, stream6 })) using (var stream = compositeStream.Transform().Apply(typeof(IdentityTransform))) using (var reader = XmlReader.Create(stream)) { reader.MoveToContent(); reader.ReadOuterXml().Should().Be( "<agg:Root xmlns:agg=\"http://schemas.microsoft.com/BizTalk/2003/aggschema\">" + "<agg:InputMessagePart_0><root><one /></root></agg:InputMessagePart_0>" + "<agg:InputMessagePart_1><root><two /></root></agg:InputMessagePart_1>" + "<agg:InputMessagePart_2><root><six /></root></agg:InputMessagePart_2>" + "</agg:Root>"); } }