Mocker Members

The Mocker type exposes the following members.

Constructors


  Name Description
Public method Mocker()()()()
Initializes a new instance of the Mocker class.
Public method Mocker(Dictionary<(Of <<'(Type, IInstanceModel>)>>))
Initializes a new instance of the Mocker class with a given type map (mock dependency injection).

Methods


  Name Description
Public method AddInjections<(Of <<'(T>)>>)
Adds the injections to the specified object properties and fields.
Public method AddMock<(Of <<'(T>)>>)(Mock<(Of <<'(T>)>>), Boolean, Boolean)
Creates a MockModel with the given Mock with the option of overwriting an existing MockModel
Public method AddProperties(Type, Object)
Adds a default mock object to the writable properties in the object, if possible.
Public method AddProperties<(Of <<'(T>)>>)(T)
Adds a default mock object to the writable properties in the object, if possible.
Public method AddType(Type, Type, Func<(Of <<'(Mocker, Object>)>>), Boolean, array<Object>[]()[][])
Adds an interface to Class mapping to the typeMap for easier resolution.
Public method AddType<(Of <<'(T>)>>)(Func<(Of <<'(Mocker, T>)>>), Boolean, array<Object>[]()[][])
Adds an interface to Class mapping to the typeMap for easier resolution.
Public method AddType<(Of <<'(TInterface, TClass>)>>)(Func<(Of <<'(Mocker, TClass>)>>), Boolean, array<Object>[]()[][])
Adds an interface to Class mapping to the typeMap for easier resolution.
Public method Static member BuildExpression<(Of <<'(T>)>>)
Builds IsAny expression for the Type T.
Public method CallMethod<(Of <<'(T>)>>)
Calls the method.
Public 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.
Public method CreateInstance<(Of <<'(T>)>>)(Boolean)
Creates an instance of IFileSystem.
Public method CreateInstance<(Of <<'(T>)>>)(Boolean, array<Object>[]()[][])
Creates the instance.
Public method CreateInstanceByType<(Of <<'(T>)>>)
Creates instance by type args.
Public method 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.
Public method 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.
Public method CreateMock(Type, Boolean, array<Object>[]()[][])
Creates the MockModel from the Type. This throws an exception if the mock already exists.
Public method CreateMock<(Of <<'(T>)>>)(Boolean, array<Object>[]()[][])
Creates the MockModel from the type T. This throws an exception if the mock already exists.
Public method CreateMockInstance(Type, Boolean, array<Object>[]()[][])
Creates an instance of the mock.
Public method CreateMockInstance<(Of <<'(T>)>>)(Boolean, array<Object>[]()[][])
Creates the mock instance that is not automatically injected.
Public method 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.
Public method GetDbContext<(Of <<'(TContext>)>>)(DbContextOptions<(Of <<'(TContext>)>>), DbConnection)
Gets the database context.
Public method GetDbContext<(Of <<'(TContext>)>>)(Func<(Of <<'(DbContextOptions, TContext>)>>))
Gets the database context.
Public method 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.
Public method 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.
Public method GetHttpHandlerSetup
Gets the HTTP handler setup.
Public method Static member 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.
Public method Static member GetList<(Of <<'(T>)>>)(Int32, Func<(Of <<'(Int32, T>)>>))
Gets a list with the specified number of list items, using a custom function.
Public method Static member GetList<(Of <<'(T>)>>)(Int32, Func<(Of <<'(T>)>>))
Gets a list with the specified number of list items, using a custom function.
Public method GetMessageProtectedAsync<(Of <<'(TMock, TReturn>)>>)
Gets the message protected asynchronous.
Public method GetMethodArgData
Gets the method argument data.
Public method GetMethodDefaultData
Gets the method default data.
Public method GetMock(Type, array<Object>[]()[][])
Gets of creates the mock of type.
Public method GetMock<(Of <<'(T>)>>)(array<Object>[]()[][])
Gets or creates the mock of type T.
Public method GetMock<(Of <<'(T>)>>)(Action<(Of <<'(Mock<(Of <<'(T>)>>)>)>>), array<Object>[]()[][])
Gets the mock and allows an action against the mock.
Public method GetMockAsync<(Of <<'(T>)>>)
Gets the mock and allows an action against the mock.
Public method GetMockDbContext(Type)
Gets the mock database context.
Public method GetMockDbContext<(Of <<'(TDbContext>)>>)()()()()
Gets the mock database context.
Public method GetObject(ParameterInfo)
Gets the instance for the given ParameterInfo.
Public method GetObject(Type, Action<(Of <<'(Object>)>>))
Gets the instance for the given type.
Public method GetObject<(Of <<'(T>)>>)(Action<(Of <<'(T>)>>))
Gets the instance for the given T and runs the given function against the object.
Public method GetObject<(Of <<'(T>)>>)()()()()
Gets the object.
Public method GetObject<(Of <<'(T>)>>)(array<Object>[]()[][])
Gets the object.
Public method GetProtectedMock(Type, array<Object>[]()[][])
Gets the protected mock.
Public method GetProtectedMock<(Of <<'(T>)>>)(array<Object>[]()[][])
Gets the protected mock.
Public method GetRequiredMock(Type)
Gets the required mock.
Public method GetRequiredMock<(Of <<'(T>)>>)()()()()
Gets the required mock.
Public method GetRequiredObject<(Of <<'(T>)>>)
Gets the required object.
Public method GetStringContent
Gets the content of the string.
Public method HasParameterlessConstructor
Determines whether [has parameterless constructor] [the specified type].
Public method Initialize<(Of <<'(T>)>>)
Gets or Creates then Initializes the specified Mock of T.
Public method InvokeMethod<(Of <<'(TClass>)>>)(String, Boolean, array<Object>[]()[][])
Invokes the static method.
Public method InvokeMethod<(Of <<'(TClass>)>>)(TClass, String, Boolean, array<Object>[]()[][])
Invokes the method.
Public method RemoveMock<(Of <<'(T>)>>)
Remove specified Mock of T.

Fields


  Name Description
Public field fileSystem
The virtual mock file system that is used by mocker unless overridden with the Strict property.

Properties


  Name Description
Public property ConstructorHistory
Gets the constructor history.
Public property DbConnection
Gets the database connection. The default value is a memory Sqlite database connection unless otherwise set.
Public property ExceptionLog
Tracks internal exceptions for debugging.
Public property HttpClient
The virtual mock http client that is used by mocker unless overridden with the Strict property.
Public 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.
Public property 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.