Contract for verifying the implementation of the generic IList<(Of <(T>)>) interface.
Namespace:
MbUnit.Framework.ContractVerifiersAssembly: MbUnit (in MbUnit.dll) Version: 3.3.0.0 (3.3.610.0)
Syntax
| C# |
|---|
public class ListContract<TList, TItem> : CollectionContract<TList, TItem> where TList : IList<TItem> |
| Visual Basic (Declaration) |
|---|
Public Class ListContract(Of TList As IList(Of TItem), TItem) _ Inherits CollectionContract(Of TList, TItem) |
Type Parameters
- TList
- The type of the collection implementing IList<(Of <(T>)>).
- TItem
- The type of items contained by the list.
Remarks
Since the generic IList<(Of <(T>)>) interface is a descendant of the generic ICollection<(Of <(T>)>) interface, the contract verifier has the same tests as the CollectionContract<(Of <(TCollection, TItem>)>) contract verifier, plus the following built-in verifications:
- InsertShouldThrowException : The read-only collection throws an exception when the method Insert(Int32, T) is called. The test is not run when the contract property IsReadOnly inherited from CollectionContract<(Of <(TCollection, TItem>)>), is set to false.
- RemoveAtShouldThrowException : The read-only collection throws an exception when the method RemoveAt(Int32) is called. The test is not run when the contract property IsReadOnly inherited from CollectionContract<(Of <(TCollection, TItem>)>), is set to false.
- IndexerSetShouldThrowException : The read-only collection throws an exception when the setter of the indexer Item[([(Int32])]) is called. The test is not run when the contract property IsReadOnly inherited from CollectionContract<(Of <(TCollection, TItem>)>), is set to false.
- InsertNullArgument : The collection throwns a ArgumentNullException when the method Insert(Int32, T) is called with a null reference item. The test is not run when the contract property AcceptNullReference inherited from CollectionContract<(Of <(TCollection, TItem>)>), is set to true.
- IndexOfNullArgument : The collection throwns a ArgumentNullException when the method IndexOf(T) is called with a null reference item. The test is not run when the contract property AcceptNullReference inherited from CollectionContract<(Of <(TCollection, TItem>)>), is set to true.
- IndexerSetNullArgument : The collection throwns a ArgumentNullException when the setter of the indexer Item[([(Int32])]) is called with a null reference item. The test is not run when the contract property AcceptNullReference inherited from CollectionContract<(Of <(TCollection, TItem>)>), is set to true.
- InsertItems : The collection handles correctly with the insertion of new items. The method Contains(T) and the property Count are expected to return suitable results as well. The case of duplicate items (object equality) is tested too; according to the value of contract property AcceptEqualItems, inherited from CollectionContract<(Of <(TCollection, TItem>)>). The test is not run when the contract property IsReadOnly inherited from CollectionContract<(Of <(TCollection, TItem>)>), is set to true.
- InsertItemsAtInvalidIndex : The collection handles correctly with the insertion of new items at an invalid index. The method should throw an ArgumentOutOfRangeException when called with a negative index or with an index greater than the number of items in the list. The test is not run when the contract property IsReadOnly inherited from CollectionContract<(Of <(TCollection, TItem>)>), is set to true.
- RemoveItemsAt : The collection handles correctly with the removal of items at specific indexes. The method Contains(T) and the property Count are expected to return suitable results as well. The test is not run when the contract property IsReadOnly inherited from CollectionContract<(Of <(TCollection, TItem>)>), is set to true.
- RemoveItemsAtInvalidIndex : The collection handles correctly with the removal of items at an invalid index. The method should throw an ArgumentOutOfRangeException when called with a negative index or with an index greater than the number of items in the list. The test is not run when the contract property IsReadOnly inherited from CollectionContract<(Of <(TCollection, TItem>)>), is set to true.
- GetItemsAtInvalidIndex : The collection handles correctly with the retrieval of items at an invalid index. The indexer should throw an ArgumentOutOfRangeException when called with a negative index or with an index greater than the number of items in the list.
- GetSetItemsWithIndexer : Setting and getting items by using the indexer property works as expected. The test is not run when the contract property IsReadOnly inherited from CollectionContract<(Of <(TCollection, TItem>)>), is set to true.
- IndexOfItem : The retrieval of the index of an item in the collection works as expected, and the index can be used effectively to get the item with the getter of the indexer property.
Inheritance Hierarchy
System..::.Object
MbUnit.Framework.ContractVerifiers..::.AbstractContract
MbUnit.Framework.ContractVerifiers..::.CollectionContract<(Of <(TList, TItem>)>)
MbUnit.Framework.ContractVerifiers..::.ListContract<(Of <(TList, TItem>)>)
MbUnit.Framework.ContractVerifiers..::.AbstractContract
MbUnit.Framework.ContractVerifiers..::.CollectionContract<(Of <(TList, TItem>)>)
MbUnit.Framework.ContractVerifiers..::.ListContract<(Of <(TList, TItem>)>)
