Class Fixture
Implements
Inherited Members
Namespace: Bunit
Assembly: Bunit.Web.dll
Syntax
public class Fixture : FixtureBase<Fixture>, IDisposable, IComponent
Constructors
| Improve this Doc View SourceFixture()
Creates an instance of the Fixture type.
Declaration
public Fixture()
Properties
| Improve this Doc View SourceJSInterop
Gets bUnits JSInterop, that allows setting up handlers for Microsoft.JSInterop.IJSRuntime.InvokeAsync``1(System.String,System.Object[]) invocations that components under tests will issue during testing. It also makes it possible to verify that the invocations has happened as expected.
Declaration
public BunitJSInterop JSInterop { get; }
Property Value
Type | Description |
---|---|
BunitJSInterop |
Methods
| Improve this Doc View SourceGetComponentUnderTest()
Gets (and renders) the markup/component defined in the <Fixture><ComponentUnderTest>...<ComponentUnderTest/><Fixture/> element.
The HTML/component is only rendered the first this method is called.
Declaration
public IRenderedFragment GetComponentUnderTest()
Returns
Type | Description |
---|---|
IRenderedFragment |
GetComponentUnderTest<TComponent>()
Gets (and renders) the component of type TComponent
defined in the
<Fixture><ComponentUnderTest>...<ComponentUnderTest/><Fixture/> element.
The HTML/component is only rendered the first this method is called.
Declaration
public IRenderedComponent<TComponent> GetComponentUnderTest<TComponent>()
where TComponent : IComponent
Returns
Type | Description |
---|---|
IRenderedComponent<TComponent> |
Type Parameters
Name | Description |
---|---|
TComponent | The type of component to render |
GetFragment(String)
Gets (and renders) the markup/component defined in the
<Fixture><Fragment id="id
" >...<Fragment/><Fixture/> element.
If id
is null/not provided, the component defined in the first <Fragment/> in
the <Fixture/> element is returned.
The HTML/component is only rendered the first this method is called.
Declaration
public IRenderedFragment GetFragment(string id = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The id of the fragment where the HTML/component is defined in Razor syntax. |
Returns
Type | Description |
---|---|
IRenderedFragment |
GetFragment<TComponent>(String)
Gets (and renders) the component of type TComponent
defined in the
<Fixture><Fragment id="id
" >...<Fragment/><Fixture/> element.
If id
is null/not provided, the component defined in the first <Fragment/> in
the <Fixture/> element is returned.
The HTML/component is only rendered the first this method is called.
Declaration
public IRenderedComponent<TComponent> GetFragment<TComponent>(string id = null)
where TComponent : IComponent
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The id of the fragment where the component is defined in Razor syntax. |
Returns
Type | Description |
---|---|
IRenderedComponent<TComponent> |
Type Parameters
Name | Description |
---|---|
TComponent | The type of component to render |
Run()
Declaration
protected override Task Run()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |