/// <summary> /// Does the specified unexpected value equal the specified actual value? /// </summary> /// <param name="unexpected">Unexpected value.</param> /// <param name="actual">Actual value.</param> /// <typeparam name="T">Type.</typeparam> /// <returns>True if the specified unexpected value dose not equal the specified actual value; otherwise, false.</returns> protected bool AreNotEqual <T>(T unexpected, T actual) { return(_assertionLog.Add(Assertion.AreNotEqual(unexpected, actual, _stackTraceTracker))); }
/// <summary> /// Is the specified condition false? /// </summary> /// <param name="condition">Condition.</param> /// <returns>True if the specified condition is false; otherwise, false.</returns> protected bool IsFalse(bool condition) { return(_assertionLog.Add(Assertion.IsFalse(condition, _stackTraceTracker))); }
/// <summary> /// Does the sequence of the specified expected collection match the sequence of the specified actual collection? /// </summary> /// <param name="expected">Expected sequence.</param> /// <param name="actual">Actual sequence.</param> /// <typeparam name="T">Type.</typeparam> /// <returns>True if the specified expected sequence equals the specified actual sequence; otherwise, false.</returns> protected bool SequenceEquals <T>(IEnumerable <T> expected, IEnumerable <T> actual) { return(Assertion.SequenceEquals(expected, actual, _stackTraceTracker).Aggregate(true, (passed, assertion) => passed && _assertionLog.Add(assertion))); }
protected bool IsNotEmpty <T>(IEnumerable <T> enumerable) { return(Assertion.IsNotEmpty(enumerable, _stackTraceTracker)); }
/// <summary> /// Does the specified collection not contain the specified element? /// </summary> /// <param name="enumerable">Collection of elements.</param> /// <param name="element">Element.</param> /// <typeparam name="T">Type.</typeparam> /// <returns>True if the specified collection does not contain the specified element; otherwise, false.</returns> protected bool DoesNotContain <T>(IEnumerable <T> enumerable, T element) { return(_assertionLog.Add(Assertion.DoesNotContain(enumerable, element, _stackTraceTracker))); }
/// <summary> /// Is the specified left hand side value less than or equal to the specified right hand side value? /// </summary> /// <param name="lhs">Left hand side.</param> /// <param name="rhs">Right hand side.</param> /// <typeparam name="T">Type.</typeparam> /// <returns>True if the specified left hand side is less than or equal to the specified right hand side; otherwise, false.</returns> protected bool IsLessThanOrEqualTo <T>(T lhs, T rhs) where T : IComparable { return(_assertionLog.Add(Assertion.IsLessThanOrEqualTo(lhs, rhs, _stackTraceTracker))); }
/// <summary> /// Is the specified left hand side value greater than the specified right hand side value? /// </summary> /// <param name="lhs">Left hand side.</param> /// <param name="rhs">Right hand side.</param> /// <typeparam name="T">Type.</typeparam> /// <returns>True if the specified left hand side is greater than the specified right hand side; otherwise, false.</returns> protected bool IsGreaterThan <T>(T lhs, T rhs) where T : IComparable { return(_assertionLog.Add(Assertion.IsGreaterThan(lhs, rhs, _stackTraceTracker))); }
/// <summary> /// Is the specified value not null? /// </summary> /// <param name="value">Value.</param> /// <typeparam name="T">Value type.</typeparam> /// <returns>True if the specified value is not null; otherwise, false.</returns> protected bool IsNotNull <T>(T?value) where T : struct { return(_assertionLog.Add(Assertion.IsNotNull(value, _stackTraceTracker))); }
/// <summary> /// Is the specified value null? /// </summary> /// <param name="value">Value.</param> /// <typeparam name="T">Reference type.</typeparam> /// <returns>True if the specified value is null; otherwise, false.</returns> protected bool IsNull <T>(T value) where T : class { return(_assertionLog.Add(Assertion.IsNull(value, _stackTraceTracker))); }