Skip to content

Commit 1684aff

Browse files
authored
Apply suggestions from code review
1 parent 020c2bf commit 1684aff

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

docs/site/docs/getting-started/fixture-details.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ All the parameters the <xref:Bunit.Fixture> component supports are shown in the
1818

1919
**Setup and Test Methods:**
2020

21-
Let us start by looking at the parameters that take a method as input first [__AP: do you mean that we'll first look at \<blah\> or that we'll look first at parameters that take a method as input?__]. The methods are called in the order they are listed below, and should be used for the described purpose:
21+
Let us start by looking at the parameters that take a method or lambda as input. The methods are called in the order they are listed below, and should be used for the described purpose:
2222

2323
1. **<xref:Bunit.RazorTesting.FixtureBase`1.Setup>** and **<xref:Bunit.RazorTesting.FixtureBase`1.SetupAsync>:**
2424
The `Setup` and `SetupAsync` methods are called first, and you can provide both if needed. If both are provided, `Setup` is called first.
@@ -31,7 +31,6 @@ In the example above, the setup and test methods are declared in a `@code { }` b
3131

3232
You can place the methods anywhere you want inside the test component, which can be useful. For example, if you have the same setup steps for multiple tests, you can avoid code duplication by placing them in a common setup method that can be shared by the tests in the same test component.
3333

34-
TODO EGIL [__AP: <== !!__]
3534

3635
**Other parameters**
3736

@@ -77,7 +76,7 @@ The <xref:Bunit.Fixture>'s setup and test methods receive the <xref:Bunit.Fixtur
7776

7877
For both `GetFragment` methods, the `id` string parameter is optional. If it is not provided, the first <xref:Bunit.Fragment> is used to return a <xref:Bunit.IRenderedFragment> or <xref:Bunit.IRenderedComponent`1>. Otherwise, the <xref:Bunit.Fragment> with an `Id` parameter that matches the `id` specified in the `GetFragment` method call will be used.
7978

80-
The generic versions of <xref:Bunit.Fixture.GetComponentUnderTest``1> and <xref:Bunit.Fixture.GetFragment``1(System.String)> can specify a component of type `TComponent` which is not the first child of <xref:Bunit.ComponentUnderTest> or <xref:Bunit.Fragment>. This is useful in situations such as the component under test being wrapped inside a `<CascadingValue>`. The methods [__AP: method or methods?__] will return the _first_ component it [__AP: it or they?__] finds that matches the requested type through a depth-first search of the render tree.
79+
The generic versions of <xref:Bunit.Fixture.GetComponentUnderTest``1> and <xref:Bunit.Fixture.GetFragment``1(System.String)> can specify a component of type `TComponent` which is not the first child of <xref:Bunit.ComponentUnderTest> or <xref:Bunit.Fragment>. This is useful in situations such as the component under test being wrapped inside a `<CascadingValue>`. The `GetComponentUnderTest` and `GetFragment` methods will return the _first_ component they find that matches the requested type through a depth-first search of the render tree.
8180

8281
> [!NOTE]
8382
> You can call the `GetComponentUnderTest` or `GetFragment` methods multiple times on the same `Fixture` instance. Each call will return the same instance for the same input. However, you cannot mix the generic and non-generic versions.
@@ -102,10 +101,10 @@ Let's look at what's going on in this test:
102101

103102
1. The fixture has both a setup and test method specified. The setup method is used to register an empty list of tasks that the `<SimpleTodo>` component requires.
104103
2. The `<SimpleTodo>` component is wrapped in a `<CascadingValue>` component which passes down the "Theme" cascading value.
105-
3. The first `<Fragment>` does not have an `id`, since the `GetFragment()` method will pick the first fragment if no `id` is provided.
106-
4. The second `<Fragment Id="expected tasks">` does have an `Id`, to make it possible to get the second fragment through a call to the `GetFragment("expected tasks")` method. [__AP: Id or id?__]
104+
3. The first `<Fragment>` does not have an `Id` parameter. It is not needed since the `GetFragment(string? id = null)` method will pick the first `<Fragment>` if no `id` argument is passed to it.
105+
4. The second `<Fragment Id="expected tasks">` does have an `Id` parameter, to make it possible to get the second fragment through a call to the `GetFragment("expected tasks")` method.
107106
5. The test uses the generic version of `GetComponentUnderTest<SimpleTodo>()`, which gives us access to the instance of `SimpleTodo` and allows us to inspect its properties, e.g. `ThemeClass`.
108107

109108
This covers the “arrange”-steps in the test above and shows how you can easily access both the component under test and other fragments that you might need to write your test concisely. We will cover the details of the "act" and "assertion" steps in the <xref:interaction> and <xref:verification> pages.
110109

111-
Learn more about injecting services into components under test on the <xref:inject-services> page.
110+
Learn more about injecting services into components under test on the <xref:inject-services> page.

0 commit comments

Comments
 (0)