Table of Contents

Class StubComponentFactoryCollectionExtensions

Namespace
Bunit
Assembly
Bunit.Web.dll

Extension methods for using component doubles.

public static class StubComponentFactoryCollectionExtensions
Inheritance
StubComponentFactoryCollectionExtensions
Inherited Members

Methods

AddStub(ComponentFactoryCollection, Predicate<Type>)

Configures bUnit to use replace all components whose type make the componentTypePredicate predicate return true with a Stub<TComponent> component in the render tree.

public static ComponentFactoryCollection AddStub(this ComponentFactoryCollection factories, Predicate<Type> componentTypePredicate)

Parameters

factories ComponentFactoryCollection

The bUnit ComponentFactoryCollection to configure.

componentTypePredicate Predicate<Type>

The predicate which decides if a component should be replaced with a Stub<TComponent> component.

Returns

ComponentFactoryCollection

A ComponentFactoryCollection.

AddStub(ComponentFactoryCollection, Predicate<Type>, RenderFragment)

Configures bUnit to use replace all components whose type make the componentTypePredicate predicate return true with a Stub<TComponent> component in the render tree.

public static ComponentFactoryCollection AddStub(this ComponentFactoryCollection factories, Predicate<Type> componentTypePredicate, RenderFragment replacementFragment)

Parameters

factories ComponentFactoryCollection

The bUnit ComponentFactoryCollection to configure.

componentTypePredicate Predicate<Type>

The predicate which decides if a component should be replaced with a Stub<TComponent> component.

replacementFragment RenderFragment

Replacement RenderFragment that will be used to render output instead of the stubbed out components.

Returns

ComponentFactoryCollection

A ComponentFactoryCollection.

AddStub(ComponentFactoryCollection, Predicate<Type>, string)

Configures bUnit to use replace all components whose type make the componentTypePredicate predicate return true with a Stub<TComponent> component in the render tree.

public static ComponentFactoryCollection AddStub(this ComponentFactoryCollection factories, Predicate<Type> componentTypePredicate, string replacementMarkup)

Parameters

factories ComponentFactoryCollection

The bUnit ComponentFactoryCollection to configure.

componentTypePredicate Predicate<Type>

The predicate which decides if a component should be replaced with a Stub<TComponent> component.

replacementMarkup string

Replacement markup that will be used to render output instead of the stubbed out components.

Returns

ComponentFactoryCollection

A ComponentFactoryCollection.

AddStub<TComponent>(ComponentFactoryCollection)

Configures bUnit to use replace all components of type TComponent (including derived components) with a Stub<TComponent> component in the render tree.

public static ComponentFactoryCollection AddStub<TComponent>(this ComponentFactoryCollection factories) where TComponent : IComponent

Parameters

factories ComponentFactoryCollection

The bUnit ComponentFactoryCollection to configure.

Returns

ComponentFactoryCollection

A ComponentFactoryCollection.

Type Parameters

TComponent

The type of component to replace with a Stub<TComponent> component.

Remarks

NOTE: This will replace any component of type TComponent or components that derives/inherits from it.

AddStub<TComponent>(ComponentFactoryCollection, RenderFragment)

Configures bUnit to use replace all components of type TComponent (including derived components) with a Stub<TComponent> component in the render tree.

public static ComponentFactoryCollection AddStub<TComponent>(this ComponentFactoryCollection factories, RenderFragment replacementFragment) where TComponent : IComponent

Parameters

factories ComponentFactoryCollection

The bUnit ComponentFactoryCollection to configure.

replacementFragment RenderFragment

Replacement render fragment that will be used as render output instead of the stubbed out component.

Returns

ComponentFactoryCollection

A ComponentFactoryCollection.

Type Parameters

TComponent

The type of component to replace with a Stub<TComponent> component.

Remarks

NOTE: This will replace any component of type TComponent or components that derives/inherits from it.

AddStub<TComponent>(ComponentFactoryCollection, RenderFragment<CapturedParameterView<TComponent>>)

Configures bUnit to use replace all components of type TComponent (including derived components) with a Stub<TComponent> component in the render tree.

public static ComponentFactoryCollection AddStub<TComponent>(this ComponentFactoryCollection factories, RenderFragment<CapturedParameterView<TComponent>> replacementTemplate) where TComponent : IComponent

Parameters

factories ComponentFactoryCollection

The bUnit ComponentFactoryCollection to configure.

replacementTemplate RenderFragment<CapturedParameterView<TComponent>>

Replacement template that will be used to render output instead of the stubbed out component.

Returns

ComponentFactoryCollection

A ComponentFactoryCollection.

Type Parameters

TComponent

The type of component to replace with a Stub<TComponent> component.

Remarks

NOTE: This will replace any component of type TComponent or components that derives/inherits from it.

AddStub<TComponent>(ComponentFactoryCollection, Func<CapturedParameterView<TComponent>, string>)

Configures bUnit to use replace all components of type TComponent (including derived components) with a Stub<TComponent> component in the render tree.

public static ComponentFactoryCollection AddStub<TComponent>(this ComponentFactoryCollection factories, Func<CapturedParameterView<TComponent>, string> replacementTemplate) where TComponent : IComponent

Parameters

factories ComponentFactoryCollection

The bUnit ComponentFactoryCollection to configure.

replacementTemplate Func<CapturedParameterView<TComponent>, string>

Replacement template that will be used to render output instead of the stubbed out component.

Returns

ComponentFactoryCollection

A ComponentFactoryCollection.

Type Parameters

TComponent

The type of component to replace with a Stub<TComponent> component.

Remarks

NOTE: This will replace any component of type TComponent or components that derives/inherits from it.

AddStub<TComponent>(ComponentFactoryCollection, string)

Configures bUnit to use replace all components of type TComponent (including derived components) with a Stub<TComponent> component in the render tree.

public static ComponentFactoryCollection AddStub<TComponent>(this ComponentFactoryCollection factories, string replacementMarkup) where TComponent : IComponent

Parameters

factories ComponentFactoryCollection

The bUnit ComponentFactoryCollection to configure.

replacementMarkup string

Markup that will be used as render output instead of the stubbed out component.

Returns

ComponentFactoryCollection

A ComponentFactoryCollection.

Type Parameters

TComponent

The type of component to replace with a Stub<TComponent> component.

Remarks

NOTE: This will replace any component of type TComponent or components that derives/inherits from it.

.NET Foundation

Supported by the .NET Foundation.