Mocker Members
The Mocker type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Mocker()()()() |
Initializes a new instance of the Mocker class.
|
|
Mocker(Dictionary<(Of <<'(Type, IInstanceModel>)>>)) |
Initializes a new instance of the Mocker class with a given type map (mock dependency injection).
|
Methods
Name | Description | |
---|---|---|
AddInjections<(Of <<'(T>)>>) |
Adds the injections to the specified object properties and fields.
|
|
AddMock<(Of <<'(T>)>>)(Mock<(Of <<'(T>)>>), Boolean, Boolean) | ||
AddProperties(Type, Object) |
Adds a default mock object to the writable properties in the object, if possible.
|
|
AddProperties<(Of <<'(T>)>>)(T) |
Adds a default mock object to the writable properties in the object, if possible.
|
|
AddType(Type, Type, Func<(Of <<'(Mocker, Object>)>>), Boolean, array<Object>[]()[][]) |
Adds an interface to Class mapping to the typeMap for easier resolution.
|
|
AddType<(Of <<'(T>)>>)(Func<(Of <<'(Mocker, T>)>>), Boolean, array<Object>[]()[][]) |
Adds an interface to Class mapping to the typeMap for easier resolution.
|
|
AddType<(Of <<'(TInterface, TClass>)>>)(Func<(Of <<'(Mocker, TClass>)>>), Boolean, array<Object>[]()[][]) |
Adds an interface to Class mapping to the typeMap for easier resolution.
|
|
BuildExpression<(Of <<'(T>)>>) |
Builds IsAny expression for the Type T.
|
|
CallMethod<(Of <<'(T>)>>) |
Calls the method.
|
|
CreateInstance<(Of <<'(T>)>>)(array<Object>[]()[][]) |
Creates an instance of T. Parameter data allows matching of constructors by type and uses those values in
the creation of the instance.
|
|
CreateInstance<(Of <<'(T>)>>)(Boolean) |
Creates an instance of IFileSystem.
|
|
CreateInstance<(Of <<'(T>)>>)(Boolean, array<Object>[]()[][]) |
Creates the instance.
|
|
CreateInstanceByType<(Of <<'(T>)>>) |
Creates instance by type args.
|
|
CreateInstanceNonPublic(Type, array<Object>[]()[][]) |
Creates the instance of the given type.
Public and non-public constructors are searched.
Parameters allow matching of constructors and using those values in the creation of the instance.
|
|
CreateInstanceNonPublic<(Of <<'(T>)>>)(array<Object>[]()[][]) |
Creates the instance of the given type.
Public and non-public constructors are searched.
Parameters allow matching of constructors and using those values in the creation of the instance.
|
|
CreateMock(Type, Boolean, array<Object>[]()[][]) |
Creates the MockModel from the Type. This throws an exception if the mock already exists.
|
|
CreateMock<(Of <<'(T>)>>)(Boolean, array<Object>[]()[][]) |
Creates the MockModel from the type T. This throws an exception if the mock already exists.
|
|
CreateMockInstance(Type, Boolean, array<Object>[]()[][]) |
Creates an instance of the mock.
|
|
CreateMockInstance<(Of <<'(T>)>>)(Boolean, array<Object>[]()[][]) |
Creates the mock instance that is not automatically injected.
|
|
GetArgData<(Of <<'(T>)>>) |
Gets the argument data for the given type T.
Public and non-public constructors are used.
A data map is used to fill in the data used in the constructor by the parameter type.
If the data is missing for a given parameter type, Mocks or default values are used.
|
|
GetDbContext<(Of <<'(TContext>)>>)(DbContextOptions<(Of <<'(TContext>)>>), DbConnection) |
Gets the database context.
|
|
GetDbContext<(Of <<'(TContext>)>>)(Func<(Of <<'(DbContextOptions, TContext>)>>)) |
Gets the database context.
|
|
GetDbContext<(Of <<'(TContext>)>>)(Func<(Of <<'(DbContextOptions<(Of <<'(TContext>)>>), TContext>)>>), DbContextOptions<(Of <<'(TContext>)>>), DbConnection) |
Gets the database context using a SqlLite DB or provided options and DbConnection.
|
|
GetFileSystem |
Gets the IFileSystem used in this context.
Generally, this means the Mocker.fileSystem property; unless strict is turned on, then it is a Mock.
|
|
GetHttpHandlerSetup |
Gets the HTTP handler setup.
|
|
GetList<(Of <<'(T>)>>)(Int32, Func<(Of <<'(Int32, T>)>>), Action<(Of <<'(Int32, T>)>>)) |
Gets a list with the specified number of list items, using a custom function.
|
|
GetList<(Of <<'(T>)>>)(Int32, Func<(Of <<'(Int32, T>)>>)) |
Gets a list with the specified number of list items, using a custom function.
|
|
GetList<(Of <<'(T>)>>)(Int32, Func<(Of <<'(T>)>>)) |
Gets a list with the specified number of list items, using a custom function.
|
|
GetMessageProtectedAsync<(Of <<'(TMock, TReturn>)>>) |
Gets the message protected asynchronous.
|
|
GetMethodArgData |
Gets the method argument data.
|
|
GetMethodDefaultData |
Gets the method default data.
|
|
GetMock(Type, array<Object>[]()[][]) |
Gets of creates the mock of type.
|
|
GetMock<(Of <<'(T>)>>)(array<Object>[]()[][]) |
Gets or creates the mock of type T.
|
|
GetMock<(Of <<'(T>)>>)(Action<(Of <<'(Mock<(Of <<'(T>)>>)>)>>), array<Object>[]()[][]) |
Gets the mock and allows an action against the mock.
|
|
GetMockAsync<(Of <<'(T>)>>) |
Gets the mock and allows an action against the mock.
|
|
GetMockDbContext(Type) |
Gets the mock database context.
|
|
GetMockDbContext<(Of <<'(TDbContext>)>>)()()()() |
Gets the mock database context.
|
|
GetObject(ParameterInfo) |
Gets the instance for the given ParameterInfo.
|
|
GetObject(Type, Action<(Of <<'(Object>)>>)) |
Gets the instance for the given type.
|
|
GetObject<(Of <<'(T>)>>)(Action<(Of <<'(T>)>>)) |
Gets the instance for the given T and runs the given function against the object.
|
|
GetObject<(Of <<'(T>)>>)()()()() |
Gets the object.
|
|
GetObject<(Of <<'(T>)>>)(array<Object>[]()[][]) |
Gets the object.
|
|
GetProtectedMock(Type, array<Object>[]()[][]) |
Gets the protected mock.
|
|
GetProtectedMock<(Of <<'(T>)>>)(array<Object>[]()[][]) |
Gets the protected mock.
|
|
GetRequiredMock(Type) |
Gets the required mock.
|
|
GetRequiredMock<(Of <<'(T>)>>)()()()() |
Gets the required mock.
|
|
GetRequiredObject<(Of <<'(T>)>>) |
Gets the required object.
|
|
GetStringContent |
Gets the content of the string.
|
|
HasParameterlessConstructor |
Determines whether [has parameterless constructor] [the specified type].
|
|
Initialize<(Of <<'(T>)>>) |
Gets or Creates then Initializes the specified Mock of T.
|
|
InvokeMethod<(Of <<'(TClass>)>>)(String, Boolean, array<Object>[]()[][]) |
Invokes the static method.
|
|
InvokeMethod<(Of <<'(TClass>)>>)(TClass, String, Boolean, array<Object>[]()[][]) |
Invokes the method.
|
|
RemoveMock<(Of <<'(T>)>>) |
Remove specified Mock of T.
|
Fields
Name | Description | |
---|---|---|
fileSystem |
The virtual mock file system that is used by mocker unless overridden with the Strict property.
|
Properties
Name | Description | |
---|---|---|
ConstructorHistory |
Gets the constructor history.
|
|
DbConnection |
Gets the database connection. The default value is a memory Sqlite database connection unless otherwise set.
|
|
ExceptionLog |
Tracks internal exceptions for debugging.
|
|
HttpClient |
The virtual mock http client that is used by mocker unless overridden with the Strict property.
|
|
InnerMockResolution |
When creating a mocks of a class, true indicates to recursively inject the mocks inside of that class;
otherwise properties are not auto mocked.
|
|
Strict |
Gets or sets a value indicating whether this Mocker is strict.
Strict prevents certain features for automatically assuming or substituting preconfigured objects such as
IFileSystem and HttpClient.
Strict prevents private methods from being used during an invoke if public was requested. Not strict would mean
that private methods may be
substituted if the public methods are not found.
Strict prevents private constructors from being used during object creation if public was requested. Not strict
would mean that private constructors may be
substituted if the public constructors are not found.
Strict sets the MockBehavior option.
|