diff --git a/Parsers.Common/Xml/Parser.cs b/Parsers.Common/Xml/Parser.cs index 26cad77..cfe30ec 100644 --- a/Parsers.Common/Xml/Parser.cs +++ b/Parsers.Common/Xml/Parser.cs @@ -201,6 +201,7 @@ private void Step1_CharsToTokens(Queue tokens) tokens.Enqueue(token); } } + private void Step2_TokensToTree(Queue tokens, out XmlDocument root) { Stack nodes = new Stack(); diff --git a/Parsers.Common/Xml/XmlDocument.cs b/Parsers.Common/Xml/XmlDocument.cs index 5f51ba6..8128fb7 100644 --- a/Parsers.Common/Xml/XmlDocument.cs +++ b/Parsers.Common/Xml/XmlDocument.cs @@ -52,15 +52,11 @@ public static XmlDocument Load(string path) return Parse(xml); } + /// public override string GetXml() { var sb = new StringBuilder(); - if (Declaration != null) - { - sb.Append(Declaration.GetXml()); - } - foreach (var c in Children) { sb.Append(c.GetXml()); diff --git a/Parsers.CommonTests/Xml/XmlDocumentTests.cs b/Parsers.CommonTests/Xml/XmlDocumentTests.cs new file mode 100644 index 0000000..06cc7af --- /dev/null +++ b/Parsers.CommonTests/Xml/XmlDocumentTests.cs @@ -0,0 +1,28 @@ +namespace Parsers.CommonTests.Xml +{ + using FluentAssertions; + + using Microsoft.VisualStudio.TestTools.UnitTesting; + + using Skyline.DataMiner.CICD.Parsers.Common.Xml; + + [TestClass] + public class XmlDocumentTests + { + [TestMethod] + public void XmlDocument_GetXml() + { + // Arrange + const string xml = @""; + const string expectedXml = @""; + + XmlDocument document = XmlDocument.Parse(xml); + + // Act + var result = document.GetXml(); + + // Check + result.Should().BeEquivalentTo(expectedXml); + } + } +} \ No newline at end of file