mirror of
https://github.com/dcronqvist/DotTiled.git
synced 2025-05-09 02:16:02 +03:00
Add test data that fails due to bug from reported issue
This commit is contained in:
parent
aa9d8498e8
commit
81277fdaf1
10 changed files with 325 additions and 0 deletions
|
@ -315,4 +315,39 @@ public class LoaderTests
|
|||
// Assert
|
||||
DotTiledAssert.AssertProperties(customClassDefinition.Members, result.Properties);
|
||||
}
|
||||
|
||||
public static IEnumerable<object[]> Maps => TestData.MapTests;
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(Maps))]
|
||||
public void LoadMap_ValidFilesExternalTilesetsAndTemplatesWithCache_ReturnsMapThatEqualsExpected(
|
||||
string testDataFile,
|
||||
Func<string, Map> expectedMap,
|
||||
IReadOnlyCollection<ICustomTypeDefinition> customTypeDefinitions)
|
||||
{
|
||||
// Arrange
|
||||
string[] fileFormats = [".tmx", ".tmj"];
|
||||
|
||||
foreach (var fileFormat in fileFormats)
|
||||
{
|
||||
var testDataFileWithFormat = testDataFile + fileFormat;
|
||||
var resourceReader = Substitute.For<IResourceReader>();
|
||||
resourceReader.Read(Arg.Any<string>()).Returns(callInfo =>
|
||||
{
|
||||
var filePath = callInfo.Arg<string>();
|
||||
return TestData.GetRawStringFor(filePath);
|
||||
});
|
||||
|
||||
var loader = Loader.DefaultWith(
|
||||
resourceReader: resourceReader,
|
||||
customTypeDefinitions: customTypeDefinitions);
|
||||
|
||||
// Act
|
||||
var map = loader.LoadMap(testDataFileWithFormat);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(map);
|
||||
DotTiledAssert.AssertMap(expectedMap(fileFormat[1..]), map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue