New to Telerik JustMock? Download free 30-day trial

Loose

Loose mocks will create stubs for all void methods of the mocked type. For all value type members, the mock will return its default value and for all reference type members - null. For collection return types (e.g. array or IEnumerable) a non-null empty collection will be returned, instead of null.

To reach deeper-level functions, you will need to arrange them first. Loose mocks are the predecessors of the RecursiveLoose behavior, which makes them rarely used nowadays.

Syntax

Mock.Create<T>(Behavior.Loose);

Examples

To see the difference between RecursiveLoose and LooseBehavior, check this example.

See Also

In this article