Class CapturedParameterView<TComponent>
- Namespace
- Bunit.TestDoubles
- Assembly
- Bunit.Web.dll
Represents a view of parameters captured by a ComponentDoubleBase<TComponent>.
public class CapturedParameterView<TComponent> : IReadOnlyDictionary<string, object>, IReadOnlyCollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IEnumerable where TComponent : IComponent
Type Parameters
TComponent
- Inheritance
-
CapturedParameterView<TComponent>
- Implements
- Inherited Members
- Extension Methods
Properties
Count
public int Count { get; }
Property Value
Empty
Gets a empty CapturedParameterView<TComponent>.
public static CapturedParameterView<TComponent> Empty { get; }
Property Value
- CapturedParameterView<TComponent>
this[string]
Gets the value of the parameter with the key.
public object this[string key] { get; }
Parameters
keystringName of the parameter to get.
Property Value
- object
The value of the parameter
Keys
public IEnumerable<string> Keys { get; }
Property Value
Values
public IEnumerable<object> Values { get; }
Property Value
Methods
ContainsKey(string)
public bool ContainsKey(string key)
Parameters
keystring
Returns
From(ParameterView)
Create an instances of the CapturedParameterView<TComponent>
from the parameters ParameterView.
public static CapturedParameterView<TComponent> From(ParameterView parameters)
Parameters
parametersParameterViewParameters to create from.
Returns
- CapturedParameterView<TComponent>
An instance of CapturedParameterView<TComponent>.
GetEnumerator()
public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
Returns
Get<TValue>(Expression<Func<TComponent, TValue>>)
Gets the value of a parameter passed to the captured TComponent,
using the parameterSelector.
public TValue Get<TValue>(Expression<Func<TComponent, TValue>> parameterSelector)
Parameters
parameterSelectorExpression<Func<TComponent, TValue>>A parameter selector that selects the parameter property of
TComponent.
Returns
- TValue
The
TValue.
Type Parameters
TValueThe type of the parameter to find.
Exceptions
- ArgumentNullException
Thrown when
parameterSelectoris null.- ArgumentException
Thrown when the member of
TComponentselected by theparameterSelectoris not a Blazor parameter.- ParameterNotFoundException
Thrown when the selected parameter was not passed to the captured
TComponent.- InvalidCastException
Throw when the type of the value passed to the selected parameter is not the same as the selected parameters type, i.e.
TValue.
TryGetValue(string, out object)
public bool TryGetValue(string key, out object value)