Example #1
0
        public override string ToString()
        {
            var responseBodyLength = 0;

            if (ResponseBody != null)
            {
                responseBodyLength = ResponseBody.Length;
            }
            var requestTime   = RequestTime.ToString("yyyy-MM-dd HH:mm:ss.fff");
            var responseTime  = ResponseTime.ToString("yyyy-MM-dd HH:mm:ss.fff");
            var requestHeader = string.Empty;

            if (RequestHeader != null && RequestHeader.Count > 0)
            {
                requestHeader = string.Join(",", RequestHeader.Select(x => string.Format("{0}:{1}", x.Key, x.Value)));
            }
            var responseHeader = string.Empty;

            if (ResponseHeader != null && ResponseHeader.Count > 0)
            {
                responseHeader = string.Join(",", ResponseHeader.Select(x => string.Format("{0}:{1}", x.Key, x.Value)));
            }

            return(string.Format("[RequestType:{0}, RequestCode:{1}, RequestSequence:{2}, RequestTime:{3}, RequestHeader: [{4}], ResponseCode:{5}, ResponseTime:{6}, ResponseBodyLength:{7}, ResponseHeader: [{8}]]",
                                 RequestType, RequestCode, RequestSequence, requestTime, requestHeader, ResponseCode, responseTime, responseBodyLength, responseHeader));
        }
Example #2
0
        public XmlNode ToXmlNode(XmlDocument xDoc)
        {
            XmlNode xInput = xDoc.CreateElement("Input");

            // TODO: Add Description and Groupings
            xInput.AppendChild(xDoc.CreateElement("Value")).InnerText        = _value;
            xInput.AppendChild(xDoc.CreateElement("RequestTime")).InnerText  = RequestTime.ToString();
            xInput.AppendChild(xDoc.CreateElement("ResponseTime")).InnerText = ResponseTime.ToString();
            xInput.AppendChild(xDoc.CreateElement("Delay")).InnerText        = Delay.Value.Ticks.ToString();
            xInput.AppendChild(xDoc.CreateElement("Method")).InnerText       = Method.ToString();
            xInput.AppendChild(xDoc.CreateElement("Description")).AppendChild(xDoc.CreateCDataSection(Description));
            if (OptionReference != null)
            {
                xInput.AppendChild(OptionReference.ToXmlNode(xDoc));
            }
            var xInputTransforms = xInput.AppendChild(xDoc.CreateElement("Transforms"));

            if (Transforms?.Length > 0)
            {
                foreach (InputTransform inputTransform in Transforms)
                {
                    xInputTransforms.AppendChild(inputTransform.ToXmlNode(xDoc));
                }
            }

            return(xInput);
        }