Class InMemoryTestStore<T>
- Namespace
- Codebelt.Extensions.Xunit
- Assembly
- Codebelt.Extensions.Xunit.dll
Provides a default base implementation of the ITestStore<T> interface.
public class InMemoryTestStore<T> : ITestStore<T>
Type Parameters
T
The type of the object to reference in the memory store.
- Inheritance
-
ObjectInMemoryTestStore<T>
- Implements
-
ITestStore<T>
Constructors
InMemoryTestStore()
Initializes a new instance of the InMemoryTestStore<T> class.
public InMemoryTestStore()
Properties
Count
Gets the number of elements contained in the InMemoryTestStore<T>.
public int Count { get; }
Property Value
- Int32
The number of elements contained in the InMemoryTestStore<T>.
InnerStore
Gets the reference to the encapsulated store.
protected IList<T> InnerStore { get; }
Property Value
- IList<T>
The reference to the encapsulated store.
Methods
Add(T)
Adds an item to the InMemoryTestStore<T>.
public void Add(T item)
Parameters
item
TThe object to add to the InMemoryTestStore<T>.
Query(Func<T, Boolean>)
Filters the elements contained in the InMemoryTestStore<T> based on an optional predicate
.
public virtual IEnumerable<T> Query(Func<T, bool> predicate = null)
Parameters
predicate
Func<T, Boolean>The function delegate to test each element for a condition.
Returns
- IEnumerable<T>
An System.Collections.Generic.IEnumerable<T> that satisfies the condition.
QueryFor<TResult>()
Filters the elements contained in the InMemoryTestStore<T> based on the type T
.
public IEnumerable<TResult> QueryFor<TResult>()
where TResult : T
Returns
- IEnumerable<TResult>
An System.Collections.Generic.IEnumerable<T> that satisfies the condition.
Type Parameters
TResult
The concrete type that implements
T
.