Class CollectionTracker
- Namespace
- Xunit.Sdk
- Assembly
- xunit.v3.assert.dll
Base class for generic CollectionTracker<T>, which also includes some public static functionality.
public abstract class CollectionTracker : IDisposable
- Inheritance
-
CollectionTracker
- Implements
- Derived
- Inherited Members
- Extension Methods
-
Xunit.Sdk.CollectionTrackerExtensions.GetEnumerator(Xunit.Sdk.CollectionTracker)
Constructors
- CollectionTracker(IEnumerable)
Initializes a new instance of the CollectionTracker class.
Properties
- InnerEnumerable
Gets the inner enumerable that this collection track is wrapping. This is mostly provided for simplifying other APIs which require both the tracker and the collection (for example, AreCollectionsEqual(CollectionTracker?, CollectionTracker?, IEqualityComparer, bool, out int?)).
Methods
- AreCollectionsEqual(CollectionTracker?, CollectionTracker?, IEqualityComparer, bool, out int?)
Determine if two enumerable collections are equal. It contains logic that varies depending on the collection type (supporting arrays, dictionaries, sets, and generic enumerables).
- FormatIndexedMismatch(int, int, int?, out int?, int)
Formats the collection when you have a mismatched index. The formatted result will be the section of the collection from
startIndextoendIndex. These indices are usually obtained by calling GetMismatchExtents(int?, out int, out int).
- FormatIndexedMismatch(int?, out int?, int)
Formats the collection when you have a mismatched index. The formatted result will be the section of the collection surrounded by the mismatched item.
- FormatStart(int)
Formats the beginning part of the collection.
- GetMismatchExtents(int?, out int, out int)
Gets the extents to print when you find a mismatched index, in the form of a
startIndexandendIndex. If the mismatched index isnull, the extents will start at index 0.
- GetSafeEnumerator()
Gets a safe version of IEnumerator that prevents double enumeration and does all the necessary tracking required for collection formatting. Should should be the same value returned by GetEnumerator(), except non-generic.
- TypeAt(int?)
Gets the full name of the type of the element at the given index, if known. Since this uses the item cache produced by enumeration, it may return
nullwhen we haven't enumerated enough to see the given element, or if we enumerated so much that the item has left the cache, or if the item at the given index isnull. It will also returnnullwhen theindexisnull.
- Wrap(IEnumerable)
Wraps an untyped enumerable in an object-based CollectionTracker<T>.