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
key
stringName 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
key
string
Returns
From(ParameterView)
Create an instances of the CapturedParameterView<TComponent>
from the parameters
ParameterView.
public static CapturedParameterView<TComponent> From(ParameterView parameters)
Parameters
parameters
ParameterViewParameters 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
parameterSelector
Expression<Func<TComponent, TValue>>A parameter selector that selects the parameter property of
TComponent
.
Returns
- TValue
The
TValue
.
Type Parameters
TValue
The type of the parameter to find.
Exceptions
- ArgumentNullException
Thrown when
parameterSelector
is null.- ArgumentException
Thrown when the member of
TComponent
selected by theparameterSelector
is 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)