Skip to content
This repository was archived by the owner on Jul 3, 2025. It is now read-only.

Commit 998dee5

Browse files
committed
Cleanup
1 parent a6e38c7 commit 998dee5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+219
-349
lines changed

Animation2Tilemap.Test/Animation2Tilemap.Test.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
15-
<PackageReference Include="Moq" Version="4.20.72" />
16-
<PackageReference Include="xunit" Version="2.9.3" />
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0"/>
15+
<PackageReference Include="Moq" Version="4.20.72"/>
16+
<PackageReference Include="xunit" Version="2.9.3"/>
1717
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
1818
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1919
<PrivateAssets>all</PrivateAssets>
@@ -25,7 +25,7 @@
2525
</ItemGroup>
2626

2727
<ItemGroup>
28-
<ProjectReference Include="..\Animation2Tilemap\Animation2Tilemap.csproj" />
28+
<ProjectReference Include="..\Animation2Tilemap\Animation2Tilemap.csproj"/>
2929
</ItemGroup>
3030

3131
<ItemGroup>

Animation2Tilemap.Test/CommandLineOptions/AssumeAnimationOptionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ public void Register_AssumeAnimationFlagTrue_SetValueTrue()
3434
// Assert
3535
Assert.True(result.GetValueForOption(assumeAnimationOption.Option));
3636
}
37-
}
37+
}

Animation2Tilemap.Test/Common/NaturalStringComparerTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ public void Compare_ShouldReturnExpectedResult_WhenComparingSimpleStrings(string
2929
[InlineData("abc2def", "abc10def", -1)]
3030
[InlineData("abc123def", "abc22def", 1)]
3131
[InlineData("abc22def", "abc123def", -1)]
32-
public void Compare_ShouldReturnExpectedResult_WhenComparingStringsContainingNumbers(string x, string y, int expected)
32+
public void Compare_ShouldReturnExpectedResult_WhenComparingStringsContainingNumbers(string x, string y,
33+
int expected)
3334
{
3435
// Act
3536
var result = _comparer.Compare(x, y);

Animation2Tilemap.Test/Factories/TilemapFactoryTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ namespace Animation2Tilemap.Test.Factories;
1111
public class TilemapFactoryTests
1212
{
1313
private readonly TilemapFactory _factory;
14-
private readonly Mock<ITilemapDataService> _tilemapDataServiceMock;
1514
private readonly MainWorkflowOptions _options;
15+
private readonly Mock<ITilemapDataService> _tilemapDataServiceMock;
1616

1717
public TilemapFactoryTests()
1818
{
@@ -116,4 +116,4 @@ public void CreateFromTileset_WithDifferentFormats_UsesCorrectEncoding(
116116
Assert.Equal(expectedEncoding, result.TilemapLayer.Data.Encoding);
117117
Assert.Equal(expectedCompression, result.TilemapLayer.Data.Compression);
118118
}
119-
}
119+
}

Animation2Tilemap.Test/Factories/TilesetFactoryTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ namespace Animation2Tilemap.Test.Factories;
1313
public class TilesetFactoryTests
1414
{
1515
private readonly TilesetFactory _factory;
16-
private readonly Mock<ITilesetImageFactory> _tilesetImageFactoryMock;
1716
private readonly Mock<IImageHashService> _imageHashServiceMock;
17+
private readonly Mock<ITilesetImageFactory> _tilesetImageFactoryMock;
1818

1919
public TilesetFactoryTests()
2020
{
@@ -48,7 +48,7 @@ public void CreateFromImage_WithSingleFrame_CreatesTileset()
4848
var hashCalls = 0;
4949
_imageHashServiceMock
5050
.Setup(x => x.Compute(It.IsAny<Image<Rgba32>>()))
51-
.Returns(() => (uint)(++hashCalls)); // Return incrementing hash values
51+
.Returns(() => (uint)++hashCalls); // Return incrementing hash values
5252

5353
var expectedTilesetImage = new TilesetImage
5454
{
@@ -162,4 +162,4 @@ public void CreateFromImage_WithIdenticalFrames_OptimizesAnimation()
162162
Assert.Equal(32, animatedTile.Animation.Frames[0].Duration);
163163
Assert.Equal(16, animatedTile.Animation.Frames[1].Duration);
164164
}
165-
}
165+
}

Animation2Tilemap.Test/Services/ImageLoaderServiceTests.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@ public void TryLoadImages_ShouldProcessFramesIndividually_WhenInputPathPointsToD
116116
Assert.True(result);
117117
Assert.Equal(8, images.Count);
118118

119-
foreach (var image in images)
120-
{
121-
Assert.Single(image.Value);
122-
}
119+
foreach (var image in images) Assert.Single(image.Value);
123120
}
124121

125122
[Fact]
@@ -143,9 +140,6 @@ public void TryLoadImages_ShouldProcessFramesAsAnimation_WhenInputPathPointsToDi
143140
Assert.Equal(8, images["anim"].Count);
144141
Assert.Single(images);
145142

146-
foreach (var image in images["anim"])
147-
{
148-
Assert.Single(image.Frames);
149-
}
143+
foreach (var image in images["anim"]) Assert.Single(image.Frames);
150144
}
151145
}

Animation2Tilemap.Test/Services/XmlSerializerServiceTests.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,19 @@ public void Serialize_ShouldThrowArgumentNullException_WhenObjectIsNull()
4949
[XmlRoot("Person")]
5050
public class Person
5151
{
52-
[XmlElement("Name")]
53-
public string Name { get; set; } = null!;
52+
[XmlElement("Name")] public string Name { get; set; } = null!;
5453

55-
[XmlElement("Age")]
56-
public int Age { get; set; }
54+
[XmlElement("Age")] public int Age { get; set; }
5755

58-
[XmlElement("Address")]
59-
public Address Address { get; set; } = null!;
56+
[XmlElement("Address")] public Address Address { get; set; } = null!;
6057
}
6158

6259
public class Address
6360
{
64-
[XmlElement("Street")]
65-
public string Street { get; set; } = null!;
61+
[XmlElement("Street")] public string Street { get; set; } = null!;
6662

67-
[XmlElement("City")]
68-
public string City { get; set; } = null!;
63+
[XmlElement("City")] public string City { get; set; } = null!;
6964

70-
[XmlElement("ZipCode")]
71-
public string ZipCode { get; set; } = null!;
65+
[XmlElement("ZipCode")] public string ZipCode { get; set; } = null!;
7266
}
7367
}

Animation2Tilemap.Test/TestHelpers/TestOutputHelperSink.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ public void Emit(LogEvent logEvent)
2626
_output.WriteLine(writer.ToString());
2727

2828
var exception = exceptionWriter.ToString();
29-
if (string.IsNullOrWhiteSpace(exception) == false)
30-
{
31-
_output.WriteLine(exception);
32-
}
29+
if (string.IsNullOrWhiteSpace(exception) == false) _output.WriteLine(exception);
3330
}
3431
}

Animation2Tilemap.Test/TestHelpers/TestResourcesHelper.cs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,17 @@ public static string GetPath(string location)
1010
var callerClassName = new StackFrame(1).GetMethod()!.DeclaringType!.Name;
1111
var resourceFolder = Path.Combine("Resources", callerClassName);
1212
var path = Path.Combine(resourceFolder, location);
13-
if (File.Exists(path) || Directory.Exists(path))
14-
{
15-
return path;
16-
}
13+
if (File.Exists(path) || Directory.Exists(path)) return path;
1714

18-
throw new FileNotFoundException($"The file or folder {location} does not exist in the resource folder for {callerClassName}.");
15+
throw new FileNotFoundException(
16+
$"The file or folder {location} does not exist in the resource folder for {callerClassName}.");
1917
}
2018

2119
public static T[] ImportArrayFromJson<T>(string jsonFile) where T : struct
2220
{
2321
var callerClassName = new StackFrame(1).GetMethod()!.DeclaringType!.Name;
2422
var filePath = Path.Combine("Resources", callerClassName, jsonFile);
25-
if (File.Exists(filePath) == false)
26-
{
27-
throw new FileNotFoundException($"The file {filePath} does not exist.");
28-
}
23+
if (File.Exists(filePath) == false) throw new FileNotFoundException($"The file {filePath} does not exist.");
2924

3025
using var fs = new FileStream(filePath, FileMode.Open);
3126
return JsonSerializer.Deserialize<T[]>(fs) ?? [];
@@ -35,10 +30,7 @@ public static string ImportText(string fileName)
3530
{
3631
var callerClassName = new StackFrame(1).GetMethod()!.DeclaringType!.Name;
3732
var filePath = Path.Combine("Resources", callerClassName, fileName);
38-
if (File.Exists(filePath) == false)
39-
{
40-
throw new FileNotFoundException($"The file {filePath} does not exist.");
41-
}
33+
if (File.Exists(filePath) == false) throw new FileNotFoundException($"The file {filePath} does not exist.");
4234

4335
using var sr = new StreamReader(filePath);
4436
return sr.ReadToEnd();

Animation2Tilemap/CommandLineOptions/AssumeAnimationOption.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ public class AssumeAnimationOption : ICommandLineOption<bool>
88
public AssumeAnimationOption()
99
{
1010
Option = new Option<bool>(
11-
name: "--assume-animation",
12-
description: "Assume images in an input directory matching animation patterns are frames, bypassing the confirmation prompt",
11+
"--assume-animation",
12+
description:
13+
"Assume images in an input directory matching animation patterns are frames, bypassing the confirmation prompt",
1314
getDefaultValue: () => false);
1415
}
1516

0 commit comments

Comments
 (0)