Ejemplo n.º 1
0
        public static (int, XmlElement) ReadXmlElement(this ReadOnlySequence <byte> buffer)
        {
            (var size, var tokens) = buffer.ReadAvailableXmlTokens();

            if (!tokens.CanBuildXmlElement())
            {
                return(0, default);
Ejemplo n.º 2
0
        public void ReadAvailableXmlTokens_Returns_Correct_List_Of_XmlTokens(string xml, string expectedXml = null)
        {
            var buffer = new ReadOnlySequence <byte>(Encoding.UTF8.GetBytes(xml));

            if (expectedXml == null)
            {
                expectedXml = xml;
            }

            var expectedReadLength = expectedXml.Length;
            var expectedTokens     = expectedXml.GetTokens();

            (var actualReadLength, var actualTokens) = buffer.ReadAvailableXmlTokens();

            Assert.Equal(expectedReadLength, actualReadLength);
            AssertEqual(expectedTokens, actualTokens);
        }