A collection of distinct object instances associated with a particular exception type.
Namespace:
MbUnit.Framework.ContractVerifiersAssembly: MbUnit (in MbUnit.dll) Version: 3.3.0.0 (3.3.459.0)
Syntax
| C# |
|---|
public class InvalidValuesClass<T> : DistinctInstanceCollection<T> |
| Visual Basic (Declaration) |
|---|
Public Class InvalidValuesClass(Of T) _ Inherits DistinctInstanceCollection(Of T) |
Type Parameters
- T
- The type of the object instances in the collection.
Remarks
Every element represents an instance which is different from all the other elements in the collection (object equality), and which is expected to be the primary cause of an exception thrown when it is set or passed to the tested method or property.
Distinct invalid instances are used by some contract verifiers such as AccessorContract<(Of <(TTarget, TValue>)>) to check for the correct detection of invalid or unexpected value assignment.
-
Use the single-parameter constructor to create an empty collection, which can be then
populated by calling explicitely the Add(T)
method inherited from DistinctInstanceCollection<(Of <(T>)>).
CopyC#var collection = new IncompetenceClass<Foo>(typeof(ArgumentException)); collection.Add(new Foo(1)); collection.Add(new Foo(2)); collection.Add(new Foo(3));
-
Use the list initializer syntax, to create a collection initialized with some content.
CopyC#var collection = new IncompetenceClass<Foo>(typeof(ArgumentException)) { new Foo(1) new Foo(2), new Foo(3), };
-
Use the two-parameters constructor to create a collection from an pre-existing enumeration..
CopyC#var collection = new InvalidClass<Foo>(typeof(ArgumentException), Foo.GetThemAll());
Inheritance Hierarchy
System..::.Object
MbUnit.Framework.ContractVerifiers..::.DistinctInstanceCollection<(Of <(T>)>)
MbUnit.Framework.ContractVerifiers..::.InvalidValuesClass<(Of <(T>)>)
MbUnit.Framework.ContractVerifiers..::.DistinctInstanceCollection<(Of <(T>)>)
MbUnit.Framework.ContractVerifiers..::.InvalidValuesClass<(Of <(T>)>)
