TestDataFactory.cpp 1.4 KB

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