Skip to content

Commit

Permalink
Cleanup and refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
vonhoff committed Mar 24, 2024
1 parent 39fb3f1 commit 63c6df1
Show file tree
Hide file tree
Showing 46 changed files with 178 additions and 204 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.CommandLine;
using Animation2Tilemap.Console.CommandLineOptions;
using Animation2Tilemap.Console.CommandLineOptions;
using System.CommandLine;

namespace Animation2Tilemap.Console.Test.CommandLineOptions;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.CommandLine;
using Animation2Tilemap.Console.CommandLineOptions;
using Animation2Tilemap.Console.CommandLineOptions;
using System.CommandLine;

namespace Animation2Tilemap.Console.Test.CommandLineOptions;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.CommandLine;
using Animation2Tilemap.Console.CommandLineOptions;
using Animation2Tilemap.Console.CommandLineOptions;
using System.CommandLine;

namespace Animation2Tilemap.Console.Test.CommandLineOptions;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.CommandLine;
using Animation2Tilemap.Console.CommandLineOptions;
using Animation2Tilemap.Console.CommandLineOptions;
using System.CommandLine;

namespace Animation2Tilemap.Console.Test.CommandLineOptions;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.CommandLine;
using Animation2Tilemap.Console.CommandLineOptions;
using Animation2Tilemap.Console.CommandLineOptions;
using System.CommandLine;

namespace Animation2Tilemap.Console.Test.CommandLineOptions;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.CommandLine;
using Animation2Tilemap.Console.CommandLineOptions;
using Animation2Tilemap.Console.CommandLineOptions;
using System.CommandLine;

namespace Animation2Tilemap.Console.Test.CommandLineOptions;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.CommandLine;
using Animation2Tilemap.Console.CommandLineOptions;
using Animation2Tilemap.Console.CommandLineOptions;
using System.CommandLine;

namespace Animation2Tilemap.Console.Test.CommandLineOptions;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.CommandLine;
using Animation2Tilemap.Console.CommandLineOptions;
using Animation2Tilemap.Console.CommandLineOptions;
using System.CommandLine;

namespace Animation2Tilemap.Console.Test.CommandLineOptions;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.CommandLine;
using Animation2Tilemap.Console.CommandLineOptions;
using Animation2Tilemap.Console.CommandLineOptions;
using System.CommandLine;

namespace Animation2Tilemap.Console.Test.CommandLineOptions;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.CommandLine;
using Animation2Tilemap.Console.CommandLineOptions;
using Animation2Tilemap.Console.CommandLineOptions;
using System.CommandLine;

namespace Animation2Tilemap.Console.Test.CommandLineOptions;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.CommandLine;
using System.CommandLine.Binding;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using Animation2Tilemap.Core;
using Animation2Tilemap.Core.Enums;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using System.CommandLine;
using System.CommandLine.Binding;

namespace Animation2Tilemap.Console.CommandLineOptions.Binding;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.CommandLine;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using System.CommandLine;

namespace Animation2Tilemap.Console.CommandLineOptions;

Expand Down
4 changes: 2 additions & 2 deletions Animation2Tilemap.Console/CommandLineOptions/HeightOption.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.CommandLine;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using System.CommandLine;

namespace Animation2Tilemap.Console.CommandLineOptions;

Expand Down
4 changes: 2 additions & 2 deletions Animation2Tilemap.Console/CommandLineOptions/InputOption.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.CommandLine;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using System.CommandLine;

namespace Animation2Tilemap.Console.CommandLineOptions;

Expand Down
4 changes: 2 additions & 2 deletions Animation2Tilemap.Console/CommandLineOptions/MarginOption.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.CommandLine;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using System.CommandLine;

namespace Animation2Tilemap.Console.CommandLineOptions;

Expand Down
4 changes: 2 additions & 2 deletions Animation2Tilemap.Console/CommandLineOptions/OutputOption.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.CommandLine;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using System.CommandLine;

namespace Animation2Tilemap.Console.CommandLineOptions;

Expand Down
4 changes: 2 additions & 2 deletions Animation2Tilemap.Console/CommandLineOptions/SpacingOption.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.CommandLine;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using System.CommandLine;

namespace Animation2Tilemap.Console.CommandLineOptions;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.CommandLine;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using System.CommandLine;

namespace Animation2Tilemap.Console.CommandLineOptions;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.CommandLine;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using System.CommandLine;
using System.Text.RegularExpressions;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;

namespace Animation2Tilemap.Console.CommandLineOptions;

Expand Down
4 changes: 2 additions & 2 deletions Animation2Tilemap.Console/CommandLineOptions/VerboseOption.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.CommandLine;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using System.CommandLine;

namespace Animation2Tilemap.Console.CommandLineOptions;

Expand Down
4 changes: 2 additions & 2 deletions Animation2Tilemap.Console/CommandLineOptions/WidthOption.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.CommandLine;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using System.CommandLine;

namespace Animation2Tilemap.Console.CommandLineOptions;

Expand Down
8 changes: 4 additions & 4 deletions Animation2Tilemap.Console/Program.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.CommandLine;
using Animation2Tilemap.Console.CommandLineOptions;
using Animation2Tilemap.Console.CommandLineOptions.Binding;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;
using System.CommandLine;
using System.CommandLine.Builder;
using System.CommandLine.Parsing;
using System.Text;
using Animation2Tilemap.Console.CommandLineOptions;
using Animation2Tilemap.Console.CommandLineOptions.Binding;
using Animation2Tilemap.Console.CommandLineOptions.Contracts;

namespace Animation2Tilemap.Console;

Expand Down
28 changes: 14 additions & 14 deletions Animation2Tilemap.Console/Services/ConfirmationDialogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ public bool Confirm(string message, bool defaultOption)
switch (input)
{
case "Y":
{
response = true;
isValidInput = true;
break;
}
{
response = true;
isValidInput = true;
break;
}
case "N":
{
response = false;
isValidInput = true;
break;
}
{
response = false;
isValidInput = true;
break;
}
default:
{
System.Console.WriteLine("Invalid input. Please enter Y or N.");
break;
}
{
System.Console.WriteLine("Invalid input. Please enter Y or N.");
break;
}
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions Animation2Tilemap.Console/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ namespace Animation2Tilemap.Console;

public class Startup(ApplicationOptions applicationOptions)
{
public CoreApplication BuildApplication()
public Application BuildApplication()
{
var services = new ServiceCollection();
ConfigureLogging(services);
ConfigureServices(services);

var serviceProvider = services.BuildServiceProvider();
return serviceProvider.GetRequiredService<CoreApplication>();
return serviceProvider.GetRequiredService<Application>();
}

private void ConfigureLogging(IServiceCollection services)
Expand All @@ -46,6 +46,6 @@ private void ConfigureServices(IServiceCollection services)
services.AddSingleton<ITilesetFactory, TilesetFactory>();
services.AddSingleton<ITilemapFactory, TilemapFactory>();
services.AddSingleton<ITilesetImageFactory, TilesetImageFactory>();
services.AddSingleton<CoreApplication>();
services.AddSingleton<Application>();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Animation2Tilemap.Core.Common;

namespace Animation2Tilemap.Test.Common;
namespace Animation2Tilemap.Core.Test.Common;

public class NaturalStringComparerTests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using Animation2Tilemap.Core;
using Animation2Tilemap.Core.Services;
using Animation2Tilemap.Test.TestHelpers;
using Animation2Tilemap.Core.Services;
using Animation2Tilemap.Core.Test.TestHelpers;
using Serilog;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using Xunit.Abstractions;

namespace Animation2Tilemap.Test.Services;
namespace Animation2Tilemap.Core.Test.Services;

public class ImageAlignmentServiceTests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;

namespace Animation2Tilemap.Test.Services;
namespace Animation2Tilemap.Core.Test.Services;

public class ImageHashServiceTests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
using Animation2Tilemap.Core;
using Animation2Tilemap.Core.Services;
using Animation2Tilemap.Core.Services;
using Animation2Tilemap.Core.Services.Contracts;
using Animation2Tilemap.Test.TestHelpers;
using Animation2Tilemap.Core.Test.TestHelpers;
using Moq;
using Serilog;
using Serilog.Core;
using Xunit.Abstractions;

namespace Animation2Tilemap.Test.Services;
namespace Animation2Tilemap.Core.Test.Services;

public class ImageLoaderServiceTests(ITestOutputHelper testOutputHelper)
{
private readonly Mock<IConfirmationDialogService> _confirmationDialogServiceMock = new();

private readonly Logger _logger = new LoggerConfiguration()
.MinimumLevel.Verbose()
.WriteTo.Sink(new TestOutputHelperSink(testOutputHelper))
.CreateLogger();

private readonly Mock<INamePatternService> _namePatternServiceMock = new();

[Fact]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Animation2Tilemap.Core.Services;
using Animation2Tilemap.Test.TestHelpers;
using Animation2Tilemap.Core.Test.TestHelpers;
using Serilog;
using Xunit.Abstractions;

namespace Animation2Tilemap.Test.Services;
namespace Animation2Tilemap.Core.Test.Services;

public class NamePatternServiceTests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Animation2Tilemap.Core.Enums;
using Animation2Tilemap.Core.Services;
using Animation2Tilemap.Test.TestHelpers;
using Animation2Tilemap.Core.Test.TestHelpers;

namespace Animation2Tilemap.Test.Services;
namespace Animation2Tilemap.Core.Test.Services;

public class TilemapDataServiceTests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Xml.Serialization;
using Animation2Tilemap.Core.Services;

namespace Animation2Tilemap.Test.Services;
namespace Animation2Tilemap.Core.Test.Services;

public class XmlSerializerServiceTests
{
Expand All @@ -16,6 +16,7 @@ public class XmlSerializerServiceTests
ZipCode = "10001"
}
};

private readonly XmlSerializerService _xmlSerializerService = new();

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Serilog.Formatting.Display;
using Xunit.Abstractions;

namespace Animation2Tilemap.Test.TestHelpers;
namespace Animation2Tilemap.Core.Test.TestHelpers;

public class TestOutputHelperSink(ITestOutputHelper output) : ILogEventSink
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Diagnostics;
using System.Text.Json;

namespace Animation2Tilemap.Test.TestHelpers;
namespace Animation2Tilemap.Core.Test.TestHelpers;

public static class TestResourcesHelper
{
Expand Down
Loading

0 comments on commit 63c6df1

Please sign in to comment.