mirror of
https://github.com/dcronqvist/DotTiled.git
synced 2025-02-05 17:02:49 +02:00
28 lines
1.1 KiB
C#
28 lines
1.1 KiB
C#
using System.Xml;
|
|
|
|
namespace DotTiled.Tests;
|
|
|
|
public static class TmxSerializerTestData
|
|
{
|
|
public static XmlReader GetReaderFor(string testDataFile)
|
|
{
|
|
var fullyQualifiedTestDataFile = $"DotTiled.Tests.{testDataFile}";
|
|
using var stream = typeof(TmxSerializerTestData).Assembly.GetManifestResourceStream(fullyQualifiedTestDataFile)
|
|
?? throw new ArgumentException($"Test data file '{fullyQualifiedTestDataFile}' not found");
|
|
|
|
using var stringReader = new StreamReader(stream);
|
|
var xml = stringReader.ReadToEnd();
|
|
var xmlStringReader = new StringReader(xml);
|
|
return XmlReader.Create(xmlStringReader);
|
|
}
|
|
|
|
public static string GetRawStringFor(string testDataFile)
|
|
{
|
|
var fullyQualifiedTestDataFile = $"DotTiled.Tests.{testDataFile}";
|
|
using var stream = typeof(TmxSerializerTestData).Assembly.GetManifestResourceStream(fullyQualifiedTestDataFile)
|
|
?? throw new ArgumentException($"Test data file '{fullyQualifiedTestDataFile}' not found");
|
|
|
|
using var stringReader = new StreamReader(stream);
|
|
return stringReader.ReadToEnd();
|
|
}
|
|
}
|