Exemplo n.º 1
0
        internal XDocument ExecuteRequest(XmlFunction function, Parameters.Parameters parameters)
        {
            var url = new PrtgUrl(prtgClient.Server, prtgClient.UserName, prtgClient.PassHash, function, parameters);

            var response = ExecuteRequest(url);

            return(XDocument.Parse(XDocumentHelpers.SanitizeXml(response)));
        }
Exemplo n.º 2
0
        internal async Task <XDocument> ExecuteRequestAsync(XmlFunction function, Parameters.Parameters parameters)
        {
            var url = new PrtgUrl(prtgClient.Server, prtgClient.UserName, prtgClient.PassHash, function, parameters);

            var response = await ExecuteRequestAsync(url).ConfigureAwait(false);

            return(XDocument.Parse(XDocumentHelpers.SanitizeXml(response)));
        }
Exemplo n.º 3
0
        public void PrtgClient_ParsesInvalidXml()
        {
            var xml = "<prtg\0>value!</prtg>";

            var xDoc = XDocumentHelpers.SanitizeXml(xml);

            Assert.AreEqual("value!", xDoc.Element("prtg").Value);
        }
Exemplo n.º 4
0
        public void CreateElementTest()
        {
            const string Name         = "name";
            const string NamepaceName = "namespaceName";
            XElement     element      = XDocumentHelpers.CreateElement("name", "namespaceName");

            CheckName(element, Name, NamepaceName);
        }
Exemplo n.º 5
0
        internal async Task <XDocument> ExecuteRequestAsync(IXmlParameters parameters, Action <string> responseValidator = null, Func <HttpResponseMessage, Task <string> > responseParser = null)
        {
            var url = GetPrtgUrl(parameters);

            var response = await ExecuteRequestAsync(url, responseParser).ConfigureAwait(false);

            responseValidator?.Invoke(response);

            return(XDocumentHelpers.SanitizeXml(response));
        }
Exemplo n.º 6
0
        internal XDocument ExecuteRequest(IXmlParameters parameters, Action <string> responseValidator = null, Func <HttpResponseMessage, string> responseParser = null)
        {
            var url = GetPrtgUrl(parameters);

            var response = ExecuteRequest(url, responseParser);

            responseValidator?.Invoke(response);

            return(XDocumentHelpers.SanitizeXml(response));
        }
Exemplo n.º 7
0
        internal async Task <XDocument> ExecuteRequestAsync(XmlFunction function, Parameters.Parameters parameters, Action <string> responseValidator = null)
        {
            var url = GetPrtgUrl(function, parameters);

            var response = await ExecuteRequestAsync(url).ConfigureAwait(false);

            responseValidator?.Invoke(response);

            return(XDocumentHelpers.SanitizeXml(response));
        }
Exemplo n.º 8
0
        internal XDocument ExecuteRequest(XmlFunction function, Parameters.Parameters parameters, Action <string> responseValidator = null)
        {
            var url = GetPrtgUrl(function, parameters);

            var response = ExecuteRequest(url);

            responseValidator?.Invoke(response);

            return(XDocumentHelpers.SanitizeXml(response));
        }
Exemplo n.º 9
0
        public void CreateElementWithContentTest()
        {
            const string Name         = "name";
            const string NamepaceName = "namespaceName";
            var          content      = new XText("content");
            XElement     element      = XDocumentHelpers.CreateElement("name", "namespaceName", content);

            CheckName(element, Name, NamepaceName);
            List <XNode> nodes = element.Nodes().ToList();

            Assert.AreEqual(1, nodes.Count);
            Assert.AreEqual(content, nodes.Single());
        }