void MinT() { IEnumerable <DummyIComparableT> nullEnumerable = new DummyIComparableT[] { null, -1, -1, null, 0, 1, 1 }; DummyIComparableT result = null; Test.IfNot.Action.ThrowsException(() => result = nullEnumerable.MinimumT(), out Exception ex); Test.If.Value.IsEqual(result, -1); }
void MinT_ThrowsException() { IEnumerable <DummyIComparableT> empty = Enumerable.Empty <DummyIComparableT>(); IEnumerable <DummyIComparableT> nulls = new DummyIComparableT[] { null, null }; Test.If.Action.ThrowsException(() => IEnumerableTExtensions.MinimumT <DummyIComparableT>(null), out ArgumentNullException ex); Test.If.Value.IsEqual(ex.ParamName, "_this"); Test.If.Action.ThrowsException(() => empty.MinimumT(), out ArgumentException argEx); Test.If.Value.IsEqual(argEx.ParamName, "_this"); Test.If.String.StartsWith(argEx.Message, "The enumeration is empty."); Test.If.Action.ThrowsException(() => nulls.MinimumT(), out argEx); Test.If.Value.IsEqual(argEx.ParamName, "_this"); Test.If.String.StartsWith(argEx.Message, "The enumeration only contains null values."); }