You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/site/docs/providing-input/passing-parameters-to-components.md
+30-24Lines changed: 30 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,13 +9,13 @@ bUnit comes with a bunch of ways to pass parameters to a component under test.
9
9
10
10
In Razor-based tests, those written in `.razor` files, passing parameters is exactly the same as in your normal Blazor pages and components.
11
11
12
-
For C#-based test code, you can:
12
+
For C#-based test code, help is needed. This comes as:
13
13
14
-
-use loosely typed factory methods
15
-
-use a simple tuple-based syntax, i.e. `(name, value)`
16
-
-use a strongly typed builder (still experimental)
14
+
-Loosely typed factory methods
15
+
-Simple tuple-based syntax, i.e. `(name, value)`
16
+
-Strongly typed builder (still experimental)
17
17
18
-
There are two methods in bUnit that allows passing parameters:
18
+
There are two methods in bUnit that allows passing parameters in C#-based test code:
19
19
20
20
-`RenderComponent` on the test context
21
21
-`SetParametersAndRender` on a rendered component
@@ -26,15 +26,15 @@ In the following sub sections we will show both C# and Razor-based test code, ju
26
26
> In all examples below, the <xref:Bunit.ComponentParameterFactory> is imported into the test class using `using static Bunit.ComponentParameterFactory;`. This results in a lot less boilerplate code, which improves test readability.
27
27
>
28
28
> With `using static` import, we can use the factory methods like this:
0 commit comments