Class RenderedComponentExtensions
- Namespace
- Bunit
- Assembly
- bunit.dll
Helper methods for querying IRenderedComponent<TComponent>.
public static class RenderedComponentExtensions
- Inheritance
-
RenderedComponentExtensions
- Inherited Members
Methods
FindAll<TComponent>(IRenderedComponent<TComponent>, string)
Returns a refreshable collection of AngleSharp.Dom.IElements from the rendered fragment or component under test,
using the provided cssSelector, in a depth-first pre-order traversal
of the rendered nodes.
public static IReadOnlyList<IElement> FindAll<TComponent>(this IRenderedComponent<TComponent> renderedComponent, string cssSelector) where TComponent : IComponent
Parameters
renderedComponentIRenderedComponent<TComponent>The rendered fragment to search.
cssSelectorstringThe group of selectors to use.
Returns
- IReadOnlyList<IElement>
An IReadOnlyList<T>, that can be refreshed to execute the search again.
Type Parameters
TComponent
FindComponent<TChildComponent>(IRenderedComponent<IComponent>)
Finds the first component of type TChildComponent in the render tree of
this IRenderedComponent<TComponent>.
public static IRenderedComponent<TChildComponent> FindComponent<TChildComponent>(this IRenderedComponent<IComponent> renderedComponent) where TChildComponent : IComponent
Parameters
renderedComponentIRenderedComponent<IComponent>
Returns
- IRenderedComponent<TChildComponent>
Type Parameters
TChildComponentType of component to find.
Exceptions
- ComponentNotFoundException
Thrown if a component of type
TChildComponentwas not found in the render tree.
FindComponents<TChildComponent>(IRenderedComponent<IComponent>)
Finds all components of type TChildComponent in the render tree of
this IRenderedComponent<TComponent>, in depth-first order.
public static IReadOnlyList<IRenderedComponent<TChildComponent>> FindComponents<TChildComponent>(this IRenderedComponent<IComponent> renderedComponent) where TChildComponent : IComponent
Parameters
renderedComponentIRenderedComponent<IComponent>
Returns
- IReadOnlyList<IRenderedComponent<TChildComponent>>
Type Parameters
TChildComponentType of components to find.
Find<TComponent>(IRenderedComponent<TComponent>, string)
Returns the first element from the rendered fragment or component under test,
using the provided cssSelector, in a depth-first pre-order traversal
of the rendered nodes.
public static IElement Find<TComponent>(this IRenderedComponent<TComponent> renderedComponent, string cssSelector) where TComponent : IComponent
Parameters
renderedComponentIRenderedComponent<TComponent>The rendered fragment to search.
cssSelectorstringThe group of selectors to use.
Returns
- IElement
Type Parameters
TComponent
HasComponent<TChildComponent>(IRenderedComponent<IComponent>)
Checks whether the render tree the renderedComponent is the root of
contains a component of type TChildComponent.
public static bool HasComponent<TChildComponent>(this IRenderedComponent<IComponent> renderedComponent) where TChildComponent : IComponent
Parameters
renderedComponentIRenderedComponent<IComponent>The render tree to search.
Returns
- bool
True if the
renderedComponentcontains theTChildComponent; otherwise false.
Type Parameters
TChildComponentThe type of component to look for in the render tree.