1
0

Updating to VS 2026

This commit is contained in:
2025-11-13 20:30:44 +01:00
parent 1096186c40
commit 1767b55c8a
29 changed files with 230 additions and 277 deletions

View File

@@ -7,32 +7,30 @@ namespace AMWD.Common.AspNetCore.Tests.Utilities
public class HtmlHelperTest
{
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void ShouldThrowErrorOnEmptyColor()
[DataRow(null)]
[DataRow("")]
[DataRow(" ")]
public void ShouldThrowErrorOnEmptyColor(string color)
{
// arrange
// act & assert
Assert.ThrowsExactly<ArgumentNullException>(() => HtmlHelper.IsDarkColor(color));
}
[TestMethod]
public void ShouldThrowErrorOnUnsupportedColor()
{
// arrange
// act
HtmlHelper.IsDarkColor("");
Assert.ThrowsExactly<NotSupportedException>(() => HtmlHelper.IsDarkColor("hsv(1, 2, 3)"));
// assert
// exception thrown
}
[TestMethod]
[ExpectedException(typeof(NotSupportedException))]
public void ShouldThrowErrorOnUnsupportedColor()
{
// arrange
// act
HtmlHelper.IsDarkColor("hsv(1, 2, 3)");
// assert
// exception thrown
}
[DataTestMethod]
[DataRow("rgb(255, 255, 255)")]
[DataRow("rgba(255, 255, 255, .5)")]
public void ShouldReturnLightColorForWhiteRgb(string white)
@@ -46,7 +44,7 @@ namespace AMWD.Common.AspNetCore.Tests.Utilities
Assert.IsFalse(isDark);
}
[DataTestMethod]
[TestMethod]
[DataRow("#ffFFff")]
[DataRow("FFffFF")]
public void ShouldReturnLightColorForWhiteFullHex(string white)
@@ -60,7 +58,7 @@ namespace AMWD.Common.AspNetCore.Tests.Utilities
Assert.IsFalse(isDark);
}
[DataTestMethod]
[TestMethod]
[DataRow("#fFf")]
[DataRow("FfF")]
public void ShouldReturnLightColorForWhiteShortHex(string white)
@@ -74,7 +72,7 @@ namespace AMWD.Common.AspNetCore.Tests.Utilities
Assert.IsFalse(isDark);
}
[DataTestMethod]
[TestMethod]
[DataRow("rgb(0, 0, 0)")]
[DataRow("rgba(0, 0, 0, .5)")]
public void ShouldReturnDarkColorForBlackRgb(string black)
@@ -88,7 +86,7 @@ namespace AMWD.Common.AspNetCore.Tests.Utilities
Assert.IsTrue(isDark);
}
[DataTestMethod]
[TestMethod]
[DataRow("#000000")]
[DataRow("000000")]
public void ShouldReturnDarkColorForBlackFullHex(string black)
@@ -102,7 +100,7 @@ namespace AMWD.Common.AspNetCore.Tests.Utilities
Assert.IsTrue(isDark);
}
[DataTestMethod]
[TestMethod]
[DataRow("#000")]
[DataRow("000")]
public void ShouldReturnDarkColorForBlackShortHex(string black)
@@ -116,7 +114,7 @@ namespace AMWD.Common.AspNetCore.Tests.Utilities
Assert.IsTrue(isDark);
}
[DataTestMethod]
[TestMethod]
[DataRow("rgb(255, 88, 0)")]
[DataRow("rgb(0, 218, 0)")]
[DataRow("rgb(0, 168, 255)")]
@@ -133,7 +131,7 @@ namespace AMWD.Common.AspNetCore.Tests.Utilities
Assert.IsFalse(isDark);
}
[DataTestMethod]
[TestMethod]
[DataRow("rgb(253, 88, 0)")]
[DataRow("rgb(0, 217, 0)")]
[DataRow("rgb(0, 168, 253)")]

View File

@@ -42,7 +42,7 @@ namespace AMWD.Common.AspNetCore.Tests.Utilities
string hash = PasswordHelper.HashPassword(password);
// assert
Assert.IsTrue(!string.IsNullOrWhiteSpace(hash));
Assert.IsFalse(string.IsNullOrWhiteSpace(hash));
}
[TestMethod]