forked from dotnet/winforms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSystemIconsTests.cs
More file actions
69 lines (61 loc) · 2.42 KB
/
Copy pathSystemIconsTests.cs
File metadata and controls
69 lines (61 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
using Xunit;
namespace System.Drawing.Tests
{
public class SystemIconsTests
{
public static IEnumerable<object[]> SystemIcons_TestData()
{
yield return Icon(() => SystemIcons.Application);
yield return Icon(() => SystemIcons.Asterisk);
yield return Icon(() => SystemIcons.Error);
yield return Icon(() => SystemIcons.Exclamation);
yield return Icon(() => SystemIcons.Hand);
yield return Icon(() => SystemIcons.Information);
yield return Icon(() => SystemIcons.Question);
yield return Icon(() => SystemIcons.Shield);
yield return Icon(() => SystemIcons.Warning);
yield return Icon(() => SystemIcons.WinLogo);
}
public static object[] Icon(Func<Icon> getIcon) => new object[] { getIcon };
[ConditionalTheory(Helpers.IsDrawingSupported)]
[MemberData(nameof(SystemIcons_TestData))]
public void SystemIcons_Get_ReturnsExpected(Func<Icon> getIcon)
{
Icon icon = getIcon();
Assert.Same(icon, getIcon());
}
public static IEnumerable<object[]> StockIcon_TestData
{
get
{
foreach (var value in Enum.GetValues<StockIconId>())
{
yield return new object[] { value };
}
}
}
[Theory]
[MemberData(nameof(StockIcon_TestData))]
public void SystemIcons_GetStockIcon(StockIconId stockIcon)
{
using Icon icon = SystemIcons.GetStockIcon(stockIcon);
}
public static TheoryData<StockIconOptions> StockIconOptions_TestData => new()
{
StockIconOptions.LinkOverlay,
StockIconOptions.Selected,
StockIconOptions.ShellIconSize,
StockIconOptions.SmallIcon,
StockIconOptions.LinkOverlay | StockIconOptions.Selected | StockIconOptions.ShellIconSize | StockIconOptions.SmallIcon,
};
[Theory]
[MemberData(nameof(StockIconOptions_TestData))]
public void SystemIcons_GetStockIcon_Options(StockIconOptions options)
{
using Icon icon = SystemIcons.GetStockIcon(StockIconId.Shield, options);
}
}
}