Skip to content

Commit 7980881

Browse files
Expose converters to aid unit testing
1 parent 61f4683 commit 7980881

5 files changed

Lines changed: 10 additions & 8 deletions

File tree

src/ImageSharp.Web/Commands/Converters/ArrayConverter{T}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace SixLabors.ImageSharp.Web.Commands.Converters
1313
/// Converts the value of a string to a generic array.
1414
/// </summary>
1515
/// <typeparam name="T">The parameter type to convert to.</typeparam>
16-
internal sealed class ArrayConverter<T> : ICommandConverter<T[]>
16+
public sealed class ArrayConverter<T> : ICommandConverter<T[]>
1717
{
1818
/// <inheritdoc/>
1919
public Type Type => typeof(T[]);

src/ImageSharp.Web/Commands/Converters/ColorConverter.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ namespace SixLabors.ImageSharp.Web.Commands.Converters
1313
/// <summary>
1414
/// Allows the conversion of strings into rgba32 pixel colors.
1515
/// </summary>
16-
internal class ColorConverter : ICommandConverter<Color>
16+
public sealed class ColorConverter : ICommandConverter<Color>
1717
{
1818
/// <summary>
1919
/// The web color hexadecimal regex. Matches strings arranged
2020
/// in rgb, rgba, rrggbb, or rrggbbaa format to match web syntax.
2121
/// </summary>
22-
private static readonly Regex HexColorRegex = new Regex("([0-9a-fA-F]{3}){1,2}", RegexOptions.Compiled);
22+
private static readonly Regex HexColorRegex = new("([0-9a-fA-F]{3}){1,2}", RegexOptions.Compiled);
2323

2424
/// <summary>
2525
/// The number color regex.
2626
/// </summary>
27-
private static readonly Regex NumberRegex = new Regex(@"\d+", RegexOptions.Compiled);
27+
private static readonly Regex NumberRegex = new(@"\d+", RegexOptions.Compiled);
2828

2929
/// <summary>
3030
/// The color constants table map.
3131
/// </summary>
32-
private static readonly Lazy<IDictionary<string, Color>> ColorConstantsTable = new Lazy<IDictionary<string, Color>>(InitializeColorConstantsTable);
32+
private static readonly Lazy<IDictionary<string, Color>> ColorConstantsTable = new(InitializeColorConstantsTable);
3333

3434
/// <inheritdoc/>
3535
public Type Type => typeof(Color);

src/ImageSharp.Web/Commands/Converters/EnumConverter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ namespace SixLabors.ImageSharp.Web.Commands.Converters
1111
/// <summary>
1212
/// The enum converter. Allows conversion to enumerations.
1313
/// </summary>
14-
internal sealed class EnumConverter : ICommandConverter<object>
14+
public sealed class EnumConverter : ICommandConverter<object>
1515
{
16+
/// <inheritdoc/>
1617
public Type Type => typeof(Enum);
1718

1819
/// <inheritdoc/>

src/ImageSharp.Web/Commands/Converters/IntegralNumberConverter{T}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace SixLabors.ImageSharp.Web.Commands.Converters
1010
/// The generic converter for integral types.
1111
/// </summary>
1212
/// <inheritdoc/>
13-
internal sealed class IntegralNumberConverter<T> : ICommandConverter<T>
13+
public sealed class IntegralNumberConverter<T> : ICommandConverter<T>
1414
where T : struct, IConvertible, IComparable<T>
1515
{
1616
/// <inheritdoc/>

src/ImageSharp.Web/Commands/Converters/ListConverter{T}.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ namespace SixLabors.ImageSharp.Web.Commands.Converters
1313
/// Converts the value of a string to a generic list.
1414
/// </summary>
1515
/// <typeparam name="T">The type of result to return.</typeparam>
16-
internal sealed class ListConverter<T> : ICommandConverter<List<T>>
16+
public sealed class ListConverter<T> : ICommandConverter<List<T>>
1717
{
18+
/// <inheritdoc/>
1819
public Type Type => typeof(List<T>);
1920

2021
/// <inheritdoc/>

0 commit comments

Comments
 (0)