Exemple #1
0
        /// <summary>
        /// Convert C# type values to XML-RPC type values and create an argument list.
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public static XmlRpcBaseType[] MethodArgs(params object[] args)
        {
            logger.Debug("Converting C# types to XML-RPC");
            XmlRpcBaseType[] xmlRpcArgs = new XmlRpcBaseType[args.Length];

            for (int i = 0; i < args.Length; i++)
            {
                xmlRpcArgs[i] = XmlRpcTypes.ToXmlRpcValue(args[i]);
            }

            return(xmlRpcArgs);
        }
Exemple #2
0
        public ResponseMessage(MessageHeader header, string message)
        {
            Header     = header;
            RawMessage = message;
            MessageXml = XDocument.Parse(message);
            IsFault    = false;

            if (!IsCallback)
            {
                IsFault = MessageXml.Elements(XmlRpcElementNames.MethodResponse)
                          .First()
                          .Elements(XmlRpcElementNames.Fault)
                          .Any();
                ResponseData = GetResponseData();
            }
        }
        public void ElementToInstance_Converts_Types_Correctly(XElement element, object expected)
        {
            XmlRpcBaseType result = XmlRpcTypes.ElementToInstance(element);

            Assert.Equal(result, expected);
        }
        public void ToXmlRpcValue_Returns_Correct_XmlRpc_Instance_From_Various_Native_Values(object value, object expected)
        {
            XmlRpcBaseType xmlRpcValue = XmlRpcTypes.ToXmlRpcValue(value);

            Assert.Equal(expected, xmlRpcValue);
        }
        public void ToNativeValue_Returns_Correct_Type_For_Various_Basic_XmlRpcTypes(XmlRpcBaseType element, object expected)
        {
            object result = XmlRpcTypes.ToNativeValue <object>(element);

            Assert.Equal(expected, result);
        }