Tests are automatically created when populating the available test data

This commit is contained in:
Daniel Cronqvist 2024-08-12 22:07:30 +02:00
parent da5bf73ca0
commit 46d5127c72
3 changed files with 54 additions and 83 deletions

View file

@ -2,51 +2,16 @@ namespace DotTiled.Tests;
public partial class TmjMapReaderTests
{
public static IEnumerable<object[]> DeserializeMap_ValidTmjExternalTilesetsAndTemplates_ReturnsMapThatEqualsExpected_Data =>
[
["Serialization.TestData.Map.default_map.default-map.tmj", TestData.DefaultMap()]
];
public static IEnumerable<object[]> Maps => TestData.MapsThatHaveTmxAndTmj;
[Theory]
[MemberData(nameof(DeserializeMap_ValidTmjExternalTilesetsAndTemplates_ReturnsMapThatEqualsExpected_Data))]
public void TmxMapReaderReadMap_ValidTmjExternalTilesetsAndTemplates_ReturnsMapThatEqualsExpected(string testDataFile, Map expectedMap)
[MemberData(nameof(Maps))]
public void TmxMapReaderReadMap_ValidTmjExternalTilesetsAndTemplates_ReturnsMapThatEqualsExpected(
string testDataFile,
Map expectedMap,
IReadOnlyCollection<CustomTypeDefinition> customTypeDefinitions)
{
// Arrange
CustomTypeDefinition[] customTypeDefinitions = [
new CustomClassDefinition
{
Name = "TestClass",
ID = 1,
UseAs = CustomClassUseAs.Property,
Members = [
new StringProperty
{
Name = "Name",
Value = ""
},
new FloatProperty
{
Name = "Amount",
Value = 0f
}
]
},
new CustomClassDefinition
{
Name = "Test",
ID = 2,
UseAs = CustomClassUseAs.All,
Members = [
new ClassProperty
{
Name = "Yep",
PropertyType = "TestClass",
Properties = []
}
]
}
];
testDataFile += ".tmj";
var json = TestData.GetRawStringFor(testDataFile);
Template ResolveTemplate(string source)
{