MockerTestBase<(Of <(<'TComponent>)>)>..::..CreateComponent Method

Sets the Component property with a new instance while maintaining the constructor setup and any other changes.

Namespace:  FastMoq
Assembly:  FastMoq.Core (in FastMoq.Core.dll)

Syntax


protected void CreateComponent()
Protected Sub CreateComponent
protected:
void CreateComponent()

Examples


CreateComponent allows creating the component when desired, instead of in the base class constructor.
C#
public void Test() {
    Mocks.Initialize<ICarService>(mock => mock.Setup(x => x.StartCar).Returns(true));
    CreateComponent();
}