Class PropertyValueCapture<TValue>
Captures property values assigned by a fake or stub during a test.
Inherited Members
Namespace: FastMoq
Assembly: FastMoq.Core.dll
Syntax
public sealed class PropertyValueCapture<TValue>
Type Parameters
| Name | Description |
|---|---|
| TValue | The captured value type. |
Examples
var modeCapture = new PropertyValueCapture<string?>();
var sink = new FakeModeSink(modeCapture);
Mocks.AddType<IModeSink>(sink);
modeCapture.Value.Should().Be("updated");
Properties
HasValue
Gets a value indicating whether any value has been recorded.
Declaration
public bool HasValue { get; }
Property Value
| Type | Description |
|---|---|
| bool |
History
Gets the recorded history in assignment order.
Declaration
public IReadOnlyList<TValue> History { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<TValue> |
Value
Gets the most recently recorded value.
Declaration
public TValue Value { get; }
Property Value
| Type | Description |
|---|---|
| TValue |
Methods
Clear()
Clears the recorded history and current value marker.
Declaration
public void Clear()
Record(TValue)
Records a property assignment.
Declaration
public void Record(TValue value)
Parameters
| Type | Name | Description |
|---|---|---|
| TValue | value | The assigned value. |