Interface ITestRenderer
Represents a generalized Blazor renderer for testing purposes.
public interface ITestRenderer
- Extension Methods
Properties
Dispatcher
Gets the Dispatcher associated with this ITestRenderer.
Dispatcher Dispatcher { get; }
Property Value
UnhandledException
Gets a Task<TResult>, which completes when an unhandled exception is thrown during the rendering of a component, that is caught by the renderer.
Task<Exception> UnhandledException { get; }
Property Value
Methods
DispatchEventAsync(ulong, EventFieldInfo, EventArgs)
Notifies the renderer that an event has occurred.
Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo fieldInfo, EventArgs eventArgs)
Parameters
eventHandlerId
ulongThe AttributeEventHandlerId value from the original event attribute.
fieldInfo
EventFieldInfoInformation that the renderer can use to update the state of the existing render tree to match the UI.
eventArgs
EventArgsArguments to be passed to the event handler.
Returns
- Task
A Task which will complete once all asynchronous processing related to the event has completed.
DispatchEventAsync(ulong, EventFieldInfo, EventArgs, bool)
Notifies the renderer that an event has occurred.
Task DispatchEventAsync(ulong eventHandlerId, EventFieldInfo fieldInfo, EventArgs eventArgs, bool ignoreUnknownEventHandlers)
Parameters
eventHandlerId
ulongThe AttributeEventHandlerId value from the original event attribute.
fieldInfo
EventFieldInfoInformation that the renderer can use to update the state of the existing render tree to match the UI.
eventArgs
EventArgsArguments to be passed to the event handler.
ignoreUnknownEventHandlers
boolSet to true to ignore the UnknownEventHandlerIdException.
Returns
- Task
A Task which will complete once all asynchronous processing related to the event has completed.
DisposeComponents()
Disposes all components rendered by the ITestRenderer.
void DisposeComponents()
FindComponent<TComponent>(IRenderedFragmentBase)
Performs a depth-first search for the first TComponent
child component of the parentComponent
.
IRenderedComponentBase<TComponent> FindComponent<TComponent>(IRenderedFragmentBase parentComponent) where TComponent : IComponent
Parameters
parentComponent
IRenderedFragmentBaseParent component to search.
Returns
- IRenderedComponentBase<TComponent>
Type Parameters
TComponent
Type of component to find.
FindComponents<TComponent>(IRenderedFragmentBase)
Performs a depth-first search for all TComponent
child components of the parentComponent
.
IReadOnlyList<IRenderedComponentBase<TComponent>> FindComponents<TComponent>(IRenderedFragmentBase parentComponent) where TComponent : IComponent
Parameters
parentComponent
IRenderedFragmentBaseParent component to search.
Returns
- IReadOnlyList<IRenderedComponentBase<TComponent>>
Type Parameters
TComponent
Type of components to find.
RenderComponent<TComponent>(ComponentParameterCollection)
Renders a TComponent
with the parameters
passed to it.
IRenderedComponentBase<TComponent> RenderComponent<TComponent>(ComponentParameterCollection parameters) where TComponent : IComponent
Parameters
parameters
ComponentParameterCollectionThe parameters to pass to the component.
Returns
- IRenderedComponentBase<TComponent>
A IRenderedComponentBase<TComponent> that provides access to the rendered component.
Type Parameters
TComponent
The type of component to render.
RenderFragment(RenderFragment)
Renders the renderFragment
.
IRenderedFragmentBase RenderFragment(RenderFragment renderFragment)
Parameters
renderFragment
RenderFragmentThe RenderFragment to render.
Returns
- IRenderedFragmentBase
A IRenderedFragmentBase that provides access to the rendered
renderFragment
.