#include <iostream>
#include <fstream>

#include "XmlParser.h"
#include "XmlWriter.h"
#include "XmlDocument.h"

#include "File.h"

#include "TestFramework.h"
#include "TestUtils.h"

TEST_CASE(TestXmlParser, "web")
{
    XmlParser parser;

    std::ifstream xml_file;
    xml_file.open(TestUtils::getTestDataDir() / "test.xml", std::ifstream::in);
    while(xml_file.good())
    {
        std::string line;
        std::getline(xml_file, line);
        parser.processLine(line);
    }
    xml_file.close();

    XmlWriter writer;
    auto content = writer.toString(parser.getDocument().get());

    auto outFile = std::make_unique<File>(TestUtils::getTestOutputDir() / "test_out.xml");
    outFile->writeText(content);
}
