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
eventHandlerIdulongThe AttributeEventHandlerId value from the original event attribute.
fieldInfoEventFieldInfoInformation that the renderer can use to update the state of the existing render tree to match the UI.
eventArgsEventArgsArguments 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
eventHandlerIdulongThe AttributeEventHandlerId value from the original event attribute.
fieldInfoEventFieldInfoInformation that the renderer can use to update the state of the existing render tree to match the UI.
eventArgsEventArgsArguments to be passed to the event handler.
ignoreUnknownEventHandlersboolSet 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
parentComponentIRenderedFragmentBaseParent component to search.
Returns
- IRenderedComponentBase<TComponent>
Type Parameters
TComponentType 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
parentComponentIRenderedFragmentBaseParent component to search.
Returns
- IReadOnlyList<IRenderedComponentBase<TComponent>>
Type Parameters
TComponentType 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
parametersComponentParameterCollectionThe parameters to pass to the component.
Returns
- IRenderedComponentBase<TComponent>
A IRenderedComponentBase<TComponent> that provides access to the rendered component.
Type Parameters
TComponentThe type of component to render.
RenderFragment(RenderFragment)
Renders the renderFragment.
IRenderedFragmentBase RenderFragment(RenderFragment renderFragment)
Parameters
renderFragmentRenderFragmentThe RenderFragment to render.
Returns
- IRenderedFragmentBase
A IRenderedFragmentBase that provides access to the rendered
renderFragment.