private WriteContentsTo ( AddressingVersion addressingVersion, XmlDictionaryWriter writer ) : void | ||
addressingVersion | AddressingVersion | |
writer | XmlDictionaryWriter | |
Результат | void |
void IXmlSerializable.WriteXml(XmlWriter writer) { address.WriteContentsTo(AddressingVersion.WSAddressingAugust2004, writer); }
public void WriteContentsToWSA10 () { X509Certificate2 cert = new X509Certificate2 ("Test/Resources/test.cer"); EndpointAddress a = new EndpointAddress ( new Uri ("http://localhost:8080"), new X509CertificateEndpointIdentity (cert)); StringWriter sw = new StringWriter (); XmlWriterSettings xws = new XmlWriterSettings (); xws.OmitXmlDeclaration = true; using (XmlDictionaryWriter xw = XmlDictionaryWriter.CreateDictionaryWriter (XmlWriter.Create (sw, xws))) { xw.WriteStartElement ("root"); a.WriteContentsTo (AddressingVersion.WSAddressing10, xw); xw.WriteEndElement (); } Assert.AreEqual (C14N ("<root><Address xmlns=\"http://www.w3.org/2005/08/addressing\">http://localhost:8080/</Address>" + identity1 + "</root>"), C14N (sw.ToString ()), "#2"); }