Пример #1
0
 public void WriteXmlRpcFaultResponse()
 {
     XmlRpcResponse response = new XmlRpcResponse(null);
     response.Fault = new XmlRpcFault(4, "Too many parameters.");
     StringBuilder sb = new StringBuilder();
     XmlTextWriter writer = new XmlTextWriter(new StringWriter(sb));
     XmlRpcResponseSerializer serializer = new XmlRpcResponseSerializer();
     serializer.WriteResponse(writer, response, null, new TypeSerializerFactory());
     Assert.IsEqualTo(sb.ToString(), @"<?xml version=""1.0"" encoding=""utf-16""?><methodResponse><fault><value><struct><member><name>faultCode</name><value><i4>4</i4></value></member><member><name>faultString</name><value><string>Too many parameters.</string></value></member></struct></value></fault></methodResponse>");
 }
Пример #2
0
 public void WriteXmlRpcResponse()
 {
     XmlRpcResponse response = new XmlRpcResponse("South Dakota");
     StringBuilder sb = new StringBuilder();
     XmlTextWriter writer = new XmlTextWriter(new StringWriter(sb));
     XmlRpcResponseSerializer serializer = new XmlRpcResponseSerializer();
     serializer.WriteResponse(writer, response, null, new TypeSerializerFactory());
     Assert.IsEqualTo(sb.ToString(), @"<?xml version=""1.0"" encoding=""utf-16""?><methodResponse><params><param><value><string>South Dakota</string></value></param></params></methodResponse>");
 }