Enhanced C#
Language of your choice: library documentation
Static Protected Member Functions | List of all members
Loyc.Collections.Impl.TestHelpers Class Reference

Helpers methods for unit tests, especially used by Loyc collection classes but sometimes useful in other cases. More...


Source file:
Inheritance diagram for Loyc.Collections.Impl.TestHelpers:
Loyc.MiniTest.Assert

Remarks

Helpers methods for unit tests, especially used by Loyc collection classes but sometimes useful in other cases.

Static Protected Member Functions

static void ExpectList< T > (IReadOnlyList< T > list, params T[] expected)
 
static void ExpectListByEnumerator< T > (IReadOnlyList< T > list, params T[] expected)
 When testing a buggy collection type, the enumerator might behave differently than the indexer, so this alternate comparer is provided. More...
 
static void ExpectList< T > (IReadOnlyList< T > list, IList< T > expected, bool useEnumerator=false)
 
static void ExpectList< T > (IEnumerable< T > list, IEnumerable< T > expected)
 
static void AssertThrows< Type > (Action @delegate)
 
static void ExpectSet< T > (IEnumerable< T > set, params T[] expected)
 
static void ExpectSet< T > (IEnumerable< T > set, HashSet< T > expected)
 
- Static Protected Member Functions inherited from Loyc.MiniTest.Assert
static void ThrowException (StopReason reason, string format, params object[] args)
 
static bool DoublesAreEqual (double expected, double actual, double delta)
 

Additional Inherited Members

- Public Types inherited from Loyc.MiniTest.Assert
enum  StopReason {
  Success, Fail, Ignore,
  Inconclusive
}
 
- Public static fields inherited from Loyc.MiniTest.Assert
static ThreadLocalVariable< StopTestDelegate > StopTestHandler = new ThreadLocalVariable<StopTestDelegate>(ThrowException)
 
- Public Member Functions inherited from Loyc.MiniTest.Assert
delegate void StopTestDelegate (StopReason reason, string format, params object[] args)
 
- Static Public Member Functions inherited from Loyc.MiniTest.Assert
static void Fail (string format, params object[] args)
 Fails a test by invoking StopTestHandler.Value(), which, by default, throws an AssertionException. More...
 
static void Ignore (string format, params object[] args)
 Stops a test via StopTestHandler, which, by default, throws an IgnoreException. This causes the test to be reported as ignored. More...
 
static void Inconclusive (string format, params object[] args)
 Stops a test via StopTestHandler, which, by default, throws an InconclusiveException. This causes the test to be reported as inconclusive. More...
 
static void Success (string format, params object[] args)
 Stops a test via StopTestHandler, which, by default, throws a SuccessException. More...
 
static void Fail ()
 Short for Fail(""). More...
 
static void Ignore ()
 Short for Ignore(""). More...
 
static void Inconclusive ()
 Short for Inconclusive(""). More...
 
static void Success ()
 Short for Success(""). More...
 
static new void Equals (object a, object b)
 Equals() is inherited from object; you probably want to call AreEqual instead. More...
 
static new void ReferenceEquals (object a, object b)
 Verifies that two references are equal. More...
 
static void That (bool condition, string message, params object[] args)
 Calls Fail(message, args) if condition is false. More...
 
static void That (bool condition, string message)
 Calls Fail(message) if condition is false. More...
 
static void That (bool condition)
 Calls Fail() if condition is false. More...
 
static void Expect (bool condition)
 Calls Fail() if condition is false. More...
 
static Exception ThrowsAny (Type expectedExceptionType, Action code, string message, params object[] args)
 Verifies that a delegate throws a particular exception when called. More...
 
static Exception ThrowsAny (Type expectedExceptionType, Action code)
 
static T Throws< T > (Action code, string message, params object[] args)
 
static T Throws< T > (Action code)
 
static T ThrowsAny< T > (Action code, string message, params object[] args)
 
static T ThrowsAny< T > (Action code)
 
static Exception Catch (Action code, string message, params object[] args)
 Verifies that a delegate throws an exception when called and returns it. More...
 
static Exception Catch (Action code)
 Verifies that a delegate throws an exception when called and returns it. More...
 
static void DoesNotThrow (Action code, string message, params object[] args)
 Verifies that a delegate does not throw an exception More...
 
static void DoesNotThrow (Action code)
 Verifies that a delegate does not throw an exception. More...
 
static void IsTrue (bool condition, string message, params object[] args)
 
static void IsTrue (bool condition)
 
static void IsFalse (bool condition, string message, params object[] args)
 
static void IsFalse (bool condition)
 
static void IsNotNull (object anObject, string message, params object[] args)
 
static void IsNotNull (object anObject)
 
static void IsNull (object anObject, string message, params object[] args)
 
static void IsNull (object anObject)
 
static void IsNaN (double aDouble)
 
static void IsEmpty (string aString)
 
static void IsEmpty (System.Collections.IEnumerable collection)
 
static void IsNotEmpty (System.Collections.IEnumerable collection)
 
static void IsNullOrEmpty (string aString)
 
static void IsNotNullOrEmpty (string aString)
 
static void IsInstanceOf (Type expected, object actual)
 
static void IsNotInstanceOf (Type expected, object actual)
 
static void IsInstanceOf< T > (object actual)
 
static void IsNotInstanceOf< T > (object actual)
 
static void AreEqual (long expected, long actual, string message, params object[] args)
 
static void AreEqual (ulong expected, ulong actual, string message, params object[] args)
 
static void AreEqual (int expected, int actual)
 
static void AreEqual (long expected, long actual)
 
static void AreEqual (ulong expected, ulong actual)
 
static void AreEqual (decimal expected, decimal actual)
 
static void AreEqual (double expected, double actual, double delta, string message, params object[] args)
 
static void AreEqual (double expected, double actual, double delta)
 
static void AreEqual (double expected, double actual)
 
static void AreEqual (object expected, object actual, string message, params object[] args)
 
static void AreEqual (object expected, object actual)
 
static void AreNotEqual (long expected, long actual, string message, params object[] args)
 
static void AreNotEqual (ulong expected, ulong actual, string message, params object[] args)
 
static void AreNotEqual (int expected, int actual)
 
static void AreNotEqual (long expected, long actual)
 
static void AreNotEqual (ulong expected, ulong actual)
 
static void AreNotEqual (decimal expected, decimal actual)
 
static void AreNotEqual (double expected, double actual, double delta, string message, params object[] args)
 
static void AreNotEqual (double expected, double actual, double delta)
 
static void AreNotEqual (object expected, object actual, string message, params object[] args)
 
static void AreNotEqual (object expected, object actual)
 
static void AreSame (object expected, object actual, string message, params object[] args)
 
static void AreSame (object expected, object actual)
 
static void AreNotSame (object expected, object actual, string message, params object[] args)
 
static void AreNotSame (object expected, object actual)
 
static void Greater (long arg1, long arg2, string message, params object[] args)
 
static void Greater (double arg1, double arg2, string message, params object[] args)
 
static void Greater (IComparable arg1, IComparable arg2, string message, params object[] args)
 
static void Greater (int arg1, int arg2)
 
static void Greater (long arg1, long arg2)
 
static void Greater (double arg1, double arg2)
 
static void Greater (IComparable arg1, IComparable arg2)
 
static void Less (long arg1, long arg2, string message, params object[] args)
 
static void Less (double arg1, double arg2, string message, params object[] args)
 
static void Less (IComparable arg1, IComparable arg2, string message, params object[] args)
 
static void Less (int arg1, int arg2)
 
static void Less (long arg1, long arg2)
 
static void Less (double arg1, double arg2)
 
static void Less (IComparable arg1, IComparable arg2)
 
static void GreaterOrEqual (long arg1, long arg2, string message, params object[] args)
 
static void GreaterOrEqual (double arg1, double arg2, string message, params object[] args)
 
static void GreaterOrEqual (IComparable arg1, IComparable arg2, string message, params object[] args)
 
static void GreaterOrEqual (int arg1, int arg2)
 
static void GreaterOrEqual (long arg1, long arg2)
 
static void GreaterOrEqual (double arg1, double arg2)
 
static void GreaterOrEqual (IComparable arg1, IComparable arg2)
 
static void LessOrEqual (long arg1, long arg2, string message, params object[] args)
 
static void LessOrEqual (double arg1, double arg2, string message, params object[] args)
 
static void LessOrEqual (IComparable arg1, IComparable arg2, string message, params object[] args)
 
static void LessOrEqual (int arg1, int arg2)
 
static void LessOrEqual (long arg1, long arg2)
 
static void LessOrEqual (double arg1, double arg2)
 
static void LessOrEqual (IComparable arg1, IComparable arg2)
 
static void Contains (object expected, IEnumerable actual, string message, params object[] args)
 Asserts that an object is contained in a list. More...
 
static void Contains (object expected, IEnumerable actual)
 Asserts that an object is contained in a list. More...
 
- Protected Member Functions inherited from Loyc.MiniTest.Assert
 Assert ()
 You may find it useful to derive a test fixture from Assert so that you do not need to prefix every test with "Assert." More...
 

Member Function Documentation

◆ ExpectListByEnumerator< T >()

static void Loyc.Collections.Impl.TestHelpers.ExpectListByEnumerator< T > ( IReadOnlyList< T >  list,
params T[]  expected 
)
inlinestaticprotected

When testing a buggy collection type, the enumerator might behave differently than the indexer, so this alternate comparer is provided.