-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit test and fix failing new test
- Loading branch information
1 parent
ce2b16c
commit 29c9b42
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...otNet.Wpf/tests/UnitTests/PresentationCore.Tests/System/Windows/Media/KnownColorsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
namespace System.Windows.Media; | ||
|
||
public class KnownColorsTests | ||
{ | ||
[Theory] | ||
// Supported values. | ||
[InlineData(KnownColor.AliceBlue, "#FFF0F8FF")] | ||
[InlineData(KnownColor.AliceBlue, " #FFF0F8FF")] | ||
[InlineData(KnownColor.AliceBlue, " #FFF0F8FF ")] | ||
[InlineData(KnownColor.AliceBlue, "#FFF0F8FF ")] | ||
// Unsupported values. | ||
[InlineData(KnownColor.UnknownColor, "")] | ||
[InlineData(KnownColor.UnknownColor, " ")] | ||
[InlineData(KnownColor.UnknownColor, "#020B37EF")] // Random ARGB that is not a known color. | ||
[InlineData(KnownColor.UnknownColor, "# FFF0F8FF")] | ||
public void ArgbStringToKnownColor_ReturnsExpected(object expected, string? argbString) | ||
{ | ||
Assert.Equal((KnownColor)expected, KnownColors.ArgbStringToKnownColor(argbString)); | ||
} | ||
|
||
[Fact] | ||
public void ArgbStringToKnownColor_NullValue_ThrowsArgumentNullException() | ||
{ | ||
Assert.Throws<ArgumentNullException>(() => KnownColors.ArgbStringToKnownColor(argbString: null)); | ||
} | ||
} |