mirror of
https://github.com/dcronqvist/DotTiled.git
synced 2025-05-09 22:06:03 +03:00
Further README updates
This commit is contained in:
parent
30318e6194
commit
6349471a58
4 changed files with 56 additions and 13 deletions
|
@ -15,4 +15,14 @@ public static class TmxSerializerTestData
|
|||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,14 +54,19 @@ public partial class TmxSerializerMapTests
|
|||
{
|
||||
// Arrange
|
||||
using var reader = TmxSerializerTestData.GetReaderFor(testDataFile);
|
||||
var testDataFileText = TmxSerializerTestData.GetRawStringFor(testDataFile);
|
||||
Func<string, Tileset> externalTilesetResolver = (string s) => throw new NotSupportedException("External tilesets are not supported in this test");
|
||||
var tmxSerializer = new TmxSerializer(externalTilesetResolver);
|
||||
|
||||
// Act
|
||||
var map = tmxSerializer.DeserializeMap(reader);
|
||||
var raw = tmxSerializer.DeserializeMap(testDataFileText);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(map);
|
||||
AssertMap(map, expectedMap);
|
||||
|
||||
Assert.NotNull(raw);
|
||||
AssertMap(raw, expectedMap);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue