Skip to content

Commit d6888eb

Browse files
linkdotnetegil
authored andcommitted
refactor: Use TheoryData
1 parent 4d44cfb commit d6888eb

File tree

1 file changed

+49
-10
lines changed

1 file changed

+49
-10
lines changed

tests/bunit.web.tests/JSInterop/InvocationHandlers/VirtualizeJSRuntimeInvocationHandlerTest.cs

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ namespace Bunit.JSInterop.ComponentSupport;
1111

1212
public class VirtualizeJSRuntimeInvocationHandlerTest : TestContext
1313
{
14-
public static readonly IEnumerable<object[]> ItemsInCollection =
15-
[
16-
[0], [7], [30], [60], [100], [300], [500],
17-
];
14+
public static readonly TheoryData<int> ItemsInCollection = new()
15+
{
16+
0, 7, 30, 60, 100, 300, 500,
17+
};
1818

1919
[Theory(DisplayName = "Can render component using <Virtualize Items> with ChildContent")]
2020
[MemberData(nameof(ItemsInCollection))]
@@ -72,12 +72,51 @@ public void Test011(int itemsInDataSource)
7272
cut.FindAll("p").Count.ShouldBe(itemsInDataSource);
7373
}
7474

75-
public static readonly IEnumerable<object[]> ItemCountItemSizeOverscanCount =
76-
ItemsInCollection.Select(x => new object[][]
77-
{
78-
[x[0], 1, 3], [x[0], 1_000_000, 3], [x[0], 50, 1], [x[0], 50, 1_000_000], [x[0], 1, 1], [x[0], 1_000_000, 1_000_000
79-
],
80-
}).SelectMany(x => x);
75+
public static readonly TheoryData<int, float, int> ItemCountItemSizeOverscanCount = new()
76+
{
77+
{ 0, 1, 3 },
78+
{ 0, 1_000_000, 3 },
79+
{ 0, 50, 1 },
80+
{ 0, 50, 1_000_000 },
81+
{ 0, 1, 1 },
82+
{ 0, 1_000_000, 1_000_000 },
83+
{ 7, 1, 3 },
84+
{ 7, 1_000_000, 3 },
85+
{ 7, 50, 1 },
86+
{ 7, 50, 1_000_000 },
87+
{ 7, 1, 1 },
88+
{ 7, 1_000_000, 1_000_000 },
89+
{ 30, 1, 3 },
90+
{ 30, 1_000_000, 3 },
91+
{ 30, 50, 1 },
92+
{ 30, 50, 1_000_000 },
93+
{ 30, 1, 1 },
94+
{ 30, 1_000_000, 1_000_000 },
95+
{ 60, 1, 3 },
96+
{ 60, 1_000_000, 3 },
97+
{ 60, 50, 1 },
98+
{ 60, 50, 1_000_000 },
99+
{ 60, 1, 1 },
100+
{ 60, 1_000_000, 1_000_000 },
101+
{ 100, 1, 3 },
102+
{ 100, 1_000_000, 3 },
103+
{ 100, 50, 1 },
104+
{ 100, 50, 1_000_000 },
105+
{ 100, 1, 1 },
106+
{ 100, 1_000_000, 1_000_000 },
107+
{ 300, 1, 3 },
108+
{ 300, 1_000_000, 3 },
109+
{ 300, 50, 1 },
110+
{ 300, 50, 1_000_000 },
111+
{ 300, 1, 1 },
112+
{ 300, 1_000_000, 1_000_000 },
113+
{ 500, 1, 3 },
114+
{ 500, 1_000_000, 3 },
115+
{ 500, 50, 1 },
116+
{ 500, 50, 1_000_000 },
117+
{ 500, 1, 1 },
118+
{ 500, 1_000_000, 1_000_000 }
119+
};
81120

82121
[Theory(DisplayName = "Can render component using <Virtualize Items> and different ItemSize and OverscanCount")]
83122
[MemberData(nameof(ItemCountItemSizeOverscanCount))]

0 commit comments

Comments
 (0)