More lint fixing

This commit is contained in:
Daniel Cronqvist 2024-08-22 21:12:16 +02:00
parent bb8c3a133c
commit b6721934e4
7 changed files with 36 additions and 108 deletions

View file

@ -24,30 +24,15 @@ public static partial class DotTiledAssert
AssertObject((dynamic)expected, (dynamic)actual);
}
private static void AssertObject(RectangleObject expected, RectangleObject actual)
{
Assert.True(true); // A rectangle object is the same as the abstract Object
}
private static void AssertObject(RectangleObject _, RectangleObject __) => Assert.True(true); // A rectangle object is the same as the abstract Object
private static void AssertObject(EllipseObject expected, EllipseObject actual)
{
Assert.True(true); // An ellipse object is the same as the abstract Object
}
private static void AssertObject(EllipseObject _, EllipseObject __) => Assert.True(true); // An ellipse object is the same as the abstract Object
private static void AssertObject(PointObject expected, PointObject actual)
{
Assert.True(true); // A point object is the same as the abstract Object
}
private static void AssertObject(PointObject _, PointObject __) => Assert.True(true); // A point object is the same as the abstract Object
private static void AssertObject(PolygonObject expected, PolygonObject actual)
{
AssertEqual(expected.Points, actual.Points, nameof(PolygonObject.Points));
}
private static void AssertObject(PolygonObject expected, PolygonObject actual) => AssertEqual(expected.Points, actual.Points, nameof(PolygonObject.Points));
private static void AssertObject(PolylineObject expected, PolylineObject actual)
{
AssertEqual(expected.Points, actual.Points, nameof(PolylineObject.Points));
}
private static void AssertObject(PolylineObject expected, PolylineObject actual) => AssertEqual(expected.Points, actual.Points, nameof(PolylineObject.Points));
private static void AssertObject(TextObject expected, TextObject actual)
{
@ -67,9 +52,5 @@ public static partial class DotTiledAssert
AssertEqual(expected.Text, actual.Text, nameof(TextObject.Text));
}
private static void AssertObject(TileObject expected, TileObject actual)
{
// Attributes
AssertEqual(expected.GID, actual.GID, nameof(TileObject.GID));
}
private static void AssertObject(TileObject expected, TileObject actual) => AssertEqual(expected.GID, actual.GID, nameof(TileObject.GID));
}

View file

@ -28,40 +28,19 @@ public static partial class DotTiledAssert
AssertProperties((dynamic)actual, (dynamic)expected);
}
private static void AssertProperty(StringProperty expected, StringProperty actual)
{
AssertEqual(expected.Value, actual.Value, "StringProperty.Value");
}
private static void AssertProperty(StringProperty expected, StringProperty actual) => AssertEqual(expected.Value, actual.Value, "StringProperty.Value");
private static void AssertProperty(IntProperty expected, IntProperty actual)
{
AssertEqual(expected.Value, actual.Value, "IntProperty.Value");
}
private static void AssertProperty(IntProperty expected, IntProperty actual) => AssertEqual(expected.Value, actual.Value, "IntProperty.Value");
private static void AssertProperty(FloatProperty expected, FloatProperty actual)
{
AssertEqual(expected.Value, actual.Value, "FloatProperty.Value");
}
private static void AssertProperty(FloatProperty expected, FloatProperty actual) => AssertEqual(expected.Value, actual.Value, "FloatProperty.Value");
private static void AssertProperty(BoolProperty expected, BoolProperty actual)
{
AssertEqual(expected.Value, actual.Value, "BoolProperty.Value");
}
private static void AssertProperty(BoolProperty expected, BoolProperty actual) => AssertEqual(expected.Value, actual.Value, "BoolProperty.Value");
private static void AssertProperty(ColorProperty expected, ColorProperty actual)
{
AssertEqual(expected.Value, actual.Value, "ColorProperty.Value");
}
private static void AssertProperty(ColorProperty expected, ColorProperty actual) => AssertEqual(expected.Value, actual.Value, "ColorProperty.Value");
private static void AssertProperty(FileProperty expected, FileProperty actual)
{
AssertEqual(expected.Value, actual.Value, "FileProperty.Value");
}
private static void AssertProperty(FileProperty expected, FileProperty actual) => AssertEqual(expected.Value, actual.Value, "FileProperty.Value");
private static void AssertProperty(ObjectProperty expected, ObjectProperty actual)
{
AssertEqual(expected.Value, actual.Value, "ObjectProperty.Value");
}
private static void AssertProperty(ObjectProperty expected, ObjectProperty actual) => AssertEqual(expected.Value, actual.Value, "ObjectProperty.Value");
private static void AssertProperty(ClassProperty expected, ClassProperty actual)
{

View file

@ -32,49 +32,14 @@ public static partial class TestData
public static IEnumerable<object[]> MapTests =>
[
["Serialization/TestData/Map/default_map/default-map", (string f) => TestData.DefaultMap(), Array.Empty<CustomTypeDefinition>()],
["Serialization/TestData/Map/map_with_common_props/map-with-common-props", (string f) => TestData.MapWithCommonProps(), Array.Empty<CustomTypeDefinition>()],
["Serialization/TestData/Map/map_with_custom_type_props/map-with-custom-type-props", (string f) => TestData.MapWithCustomTypeProps(), TestData.MapWithCustomTypePropsCustomTypeDefinitions()],
["Serialization/TestData/Map/map_with_embedded_tileset/map-with-embedded-tileset", (string f) => TestData.MapWithEmbeddedTileset(), Array.Empty<CustomTypeDefinition>()],
["Serialization/TestData/Map/map_with_external_tileset/map-with-external-tileset", (string f) => TestData.MapWithExternalTileset(f), Array.Empty<CustomTypeDefinition>()],
["Serialization/TestData/Map/map_with_flippingflags/map-with-flippingflags", (string f) => TestData.MapWithFlippingFlags(f), Array.Empty<CustomTypeDefinition>()],
["Serialization/TestData/Map/map_external_tileset_multi/map-external-tileset-multi", (string f) => TestData.MapExternalTilesetMulti(f), Array.Empty<CustomTypeDefinition>()],
["Serialization/TestData/Map/map_external_tileset_wangset/map-external-tileset-wangset", (string f) => TestData.MapExternalTilesetWangset(f), Array.Empty<CustomTypeDefinition>()],
["Serialization/TestData/Map/map_with_many_layers/map-with-many-layers", (string f) => TestData.MapWithManyLayers(f), Array.Empty<CustomTypeDefinition>()],
];
private static CustomTypeDefinition[] typedefs = [
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 = []
}
]
}
["Serialization/TestData/Map/default_map/default-map", (string f) => DefaultMap(), Array.Empty<CustomTypeDefinition>()],
["Serialization/TestData/Map/map_with_common_props/map-with-common-props", (string f) => MapWithCommonProps(), Array.Empty<CustomTypeDefinition>()],
["Serialization/TestData/Map/map_with_custom_type_props/map-with-custom-type-props", (string f) => MapWithCustomTypeProps(), MapWithCustomTypePropsCustomTypeDefinitions()],
["Serialization/TestData/Map/map_with_embedded_tileset/map-with-embedded-tileset", (string f) => MapWithEmbeddedTileset(), Array.Empty<CustomTypeDefinition>()],
["Serialization/TestData/Map/map_with_external_tileset/map-with-external-tileset", (string f) => MapWithExternalTileset(f), Array.Empty<CustomTypeDefinition>()],
["Serialization/TestData/Map/map_with_flippingflags/map-with-flippingflags", (string f) => MapWithFlippingFlags(f), Array.Empty<CustomTypeDefinition>()],
["Serialization/TestData/Map/map_external_tileset_multi/map-external-tileset-multi", (string f) => MapExternalTilesetMulti(f), Array.Empty<CustomTypeDefinition>()],
["Serialization/TestData/Map/map_external_tileset_wangset/map-external-tileset-wangset", (string f) => MapExternalTilesetWangset(f), Array.Empty<CustomTypeDefinition>()],
["Serialization/TestData/Map/map_with_many_layers/map-with-many-layers", (string f) => MapWithManyLayers(f), Array.Empty<CustomTypeDefinition>()],
];
}