Defines a collection of incompetence classes which identify object instances that are expected to be not accepted
by the tested setter. Each incompetence class contains a collection of distinct object instance associated
with an expected exception type.
Namespace:
MbUnit.Framework.ContractVerifiersAssembly: MbUnit (in MbUnit.dll) Version: 3.2.0.0 (3.2.581.0)
Syntax
| C# |
|---|
public InvalidValuesClassCollection<TValue> InvalidValues { get; set; } |
| Visual Basic (Declaration) |
|---|
Public Property InvalidValues As InvalidValuesClassCollection(Of TValue) |
Remarks
Specifying incompetent values is entirely optional. By default, the entire collection is empty; which causes the test 'SetInvalidValues' to not be run.
Examples
The following example shows how to specify some incompetent values for the contract verifier. The example
assumes that the hypothetical 'Foo.MyProperty' property accepts any integer between 0 and 999, except 666
which is expected to throw a ArgumentException exception.
CopyC#
[TestFixture] public class FooTest { [VerifyContract] public readonly IContract MyPropertyAccessorTests = new AccessorContract<Foo, int> { PropertyName = "MyProperty", ValidValues = { 123, 456, 789 }, IncompetentValues = { { typeof(ArgumentOutOfRangeException), -100, -999, 1000, 99999 }, { typeof(ArgumentException), 666 } } }; }
