Provides a default instance of the collection to test.

Namespace:  MbUnit.Framework.ContractVerifiers
Assembly:  MbUnit (in MbUnit.dll) Version: 3.3.0.0 (3.3.610.0)

Syntax

C#
public Func<TCollection> DefaultInstance { get; set; }
Visual Basic (Declaration)
Public Property DefaultInstance As Func(Of TCollection)

Remarks

By default, the contract verifier attempts to invoke the default constructor to get an valid instance. Overwrite the default provider if the collection has no default constructor, or if you want the contract verifier to use a particular instance.

Examples

CopyC#
[VerifyContract]
public readonly IContract CollectionTests = new CollectionContract<MyCollection, int>
{
    DefaultInstance = () => new MyCollection(1, 2, 3)
};

See Also