Mocker..::..GetList<(Of <(<'T>)>)> Method (Int32, Func<(Of <(<'Int32, T>)>)>, Action<(Of <(<'Int32, T>)>)>)

Gets a list with the specified number of list items, using a custom function.

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

Syntax


public static List<T> GetList<T>(
	int count,
	Func<int, T> func,
	Action<int, T> initAction
)
Public Shared Function GetList(Of T) ( _
	count As Integer, _
	func As Func(Of Integer, T), _
	initAction As Action(Of Integer, T) _
) As List(Of T)
public:
generic<typename T>
static List<T>^ GetList(
	int^ count, 
	Func<int^, T>^ func, 
	Action<int^, T>^ initAction
)

Type Parameters

T
The Mock Type, usually an interface.

Parameters

count
Type: Int32
The number of list items.
func
Type: Func<(Of <(<'Int32, T>)>)>
The function for creating the list items.
initAction
Type: Action<(Of <(<'Int32, T>)>)>
The initialize action.

Return Value

List<T>.

Examples


Example of how to create a list.
C#
GetList<Model>(3, (i) => new Model(name: i.ToString()));
or
C#
GetList<IModel>(3, (i) => Mocks.CreateInstance<IModel>(i));