PeanutButter
Loading...
Searching...
No Matches
PeanutButter.Utils.MockStoreExtensions Class Reference

Provides basic extensions for using a mocked store against any object, levering off of PeanutButter's metadata logic. More...

Static Public Member Functions

static IDictionary< int, TEntity > FindOrAddMockStoreFor< TEntity > (this object owner)
 Finds or creates a validating store with integer primary key and TEntity entries (ie IDictionary<int, TEntity>, but not allowing invalid PK values (ie ids must be > 0)). The store is associated with the owning object for future use.
static TStore FindOrAddMockStore< TStore > (this object owner)
 Finds or creates a store of the given type TStore, associated with the owner object. TStore must be a type which has a parameterless constructor.
static TResult FindOrAddMockStore< TResult > (this object owner, Func< TResult > factory)
 Finds or creates a store of the given type TStore, associated with the owner object. If the store doesn't already exist, it is created with the provided factory.

Detailed Description

Provides basic extensions for using a mocked store against any object, levering off of PeanutButter's metadata logic.

Member Function Documentation

◆ FindOrAddMockStore< TResult >()

TResult PeanutButter.Utils.MockStoreExtensions.FindOrAddMockStore< TResult > ( this object owner,
Func< TResult > factory )
static

Finds or creates a store of the given type TStore, associated with the owner object. If the store doesn't already exist, it is created with the provided factory.

Parameters
owner
factory
Template Parameters
TResult
Returns

◆ FindOrAddMockStore< TStore >()

TStore PeanutButter.Utils.MockStoreExtensions.FindOrAddMockStore< TStore > ( this object owner)
static

Finds or creates a store of the given type TStore, associated with the owner object. TStore must be a type which has a parameterless constructor.

Parameters
owner
Template Parameters
TStore
Returns
Type Constraints
TStore :new() 

◆ FindOrAddMockStoreFor< TEntity >()

IDictionary< int, TEntity > PeanutButter.Utils.MockStoreExtensions.FindOrAddMockStoreFor< TEntity > ( this object owner)
static

Finds or creates a validating store with integer primary key and TEntity entries (ie IDictionary<int, TEntity>, but not allowing invalid PK values (ie ids must be > 0)). The store is associated with the owning object for future use.

Parameters
owner
Template Parameters
TEntity
Returns

The documentation for this class was generated from the following file:
  • source/Utils/PeanutButter.Utils/MockStoreExtensions.cs