1
0

Moved all UnitTests to a single project. Implemented parts of AspNetCore UnitTests.

This commit is contained in:
2022-07-17 12:21:05 +02:00
parent 73038bbe5a
commit a26d6a0036
46 changed files with 2411 additions and 105 deletions

View File

@@ -17,7 +17,7 @@ namespace AMWD.Common.AspNetCore.Utilities
public static bool IsDarkColor(string color)
{
if (string.IsNullOrWhiteSpace(color))
return false;
throw new ArgumentNullException(nameof(color));
int r, g, b;
@@ -27,9 +27,9 @@ namespace AMWD.Common.AspNetCore.Utilities
if (rgbMatch.Success)
{
r = Convert.ToInt32(rgbMatch.Groups[1].Value);
g = Convert.ToInt32(rgbMatch.Groups[2].Value);
b = Convert.ToInt32(rgbMatch.Groups[3].Value);
r = Convert.ToInt32(rgbMatch.Groups[1].Value, 10);
g = Convert.ToInt32(rgbMatch.Groups[2].Value, 10);
b = Convert.ToInt32(rgbMatch.Groups[3].Value, 10);
}
else if (hexMatchFull.Success)
{
@@ -45,7 +45,7 @@ namespace AMWD.Common.AspNetCore.Utilities
}
else
{
return false;
throw new NotSupportedException($"Unknown color value '{color}'");
}
double luminance = (r * 0.299 + g * 0.587 + b * 0.114) / 255;