TestDataFactory.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Co-Author: Claude Sonnet 4.6 (LLM)
  4. * Company: Lynar Studios
  5. * E-Mail: webmaster@lynarstudios.com
  6. * Created: 2022-05-14
  7. * Changed: 2026-06-23
  8. *
  9. * */
  10. #include "TestDataFactory.hpp"
  11. using ls::standard::io::XmlAttribute;
  12. using ls::standard::io::XmlNode;
  13. using std::make_shared;
  14. using std::shared_ptr;
  15. using test::io::TestDataFactory;
  16. TestDataFactory::TestDataFactory() = default;
  17. TestDataFactory::~TestDataFactory() = default;
  18. shared_ptr<XmlNode> TestDataFactory::createXmlContent()
  19. {
  20. auto root = make_shared<XmlNode>("dialog");
  21. shared_ptr<XmlAttribute> attribute{};
  22. shared_ptr<XmlNode> child{};
  23. shared_ptr<XmlNode> text{};
  24. attribute = make_shared<XmlAttribute>("name");
  25. attribute->setValue("dungeon_001");
  26. root->addAttributeToEnd(attribute);
  27. child = make_shared<XmlNode>("dialogUnit");
  28. attribute = make_shared<XmlAttribute>("id");
  29. attribute->setValue("001");
  30. child->addAttributeToEnd(attribute);
  31. text = make_shared<XmlNode>("text");
  32. text->setValue("Hello!");
  33. child->addChildToEnd(text);
  34. root->addChildToEnd(child);
  35. child = make_shared<XmlNode>("dialogUnit");
  36. attribute = make_shared<XmlAttribute>("id");
  37. attribute->setValue("002");
  38. child->addAttributeToEnd(attribute);
  39. text = make_shared<XmlNode>("text");
  40. text->setValue("Hello again!");
  41. child->addChildToEnd(text);
  42. root->addChildToEnd(child);
  43. return root;
  44. }