222 references to Throw
Shared (28)
BufferWriterPool\BufferWriter.cs (4)
74_ = Throw.IfLessThan(value, 0); 121_ = Throw.IfOutOfRange(count, 0, _buffer.Length - WrittenCount); 182Throw.InvalidOperationException("Exceeded array capacity"); 189_ = Throw.IfLessThan(sizeHint, 0);
BufferWriterPool\BufferWriterPool.cs (2)
28_ = Throw.IfLessThan(maxCapacity, 1); 29_ = Throw.IfLessThan(maxBufferWriterCapacity, 1);
BufferWriterPool\BufferWriterPooledObjectPolicy.cs (2)
37MaximumRetainedCapacity = Throw.IfLessThan(maximumRetainedCapacity, 1); 63_ = Throw.IfNull(obj);
Data.Validation\TimeSpanAttribute.cs (3)
88_ = Throw.IfNullOrWhitespace(min); 101_ = Throw.IfNullOrWhitespace(min); 102_ = Throw.IfNullOrWhitespace(max);
Debugger\DebuggerExtensions.cs (3)
27_ = Throw.IfNull(services); 41_ = Throw.IfNull(services); 55_ = Throw.IfNull(services);
Memoization\MemoizedFunction.cs (2)
68_function = Throw.IfNull(function); 141_function = Throw.IfNull(function);
Pools\PoolFactory.cs (12)
42_ = Throw.IfLessThan(maxCapacity, 1); 57_ = Throw.IfNull(policy); 58_ = Throw.IfLessThan(maxCapacity, 1); 75_ = Throw.IfLessThan(maxCapacity, 1); 88_ = Throw.IfLessThan(maxCapacity, 1); 89_ = Throw.IfLessThan(maxStringBuilderCapacity, 1); 116_ = Throw.IfLessThan(maxCapacity, 1); 134_ = Throw.IfLessThan(maxCapacity, 1); 135_ = Throw.IfLessThan(listCapacity, 0); 155_ = Throw.IfLessThan(maxCapacity, 1); 174_ = Throw.IfLessThan(maxCapacity, 1); 196_ = Throw.IfLessThan(maxCapacity, 1);
Shared.Tests (194)
Throw\DoubleTests.cs (31)
18var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfLessThan(0.0, 1.0, "paramName")); 22exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfLessThan(double.NaN, 1.0, "paramName")); 30var exception = Record.Exception(() => Throw.IfLessThan(0.0, 0.0, "paramName")); 37var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfGreaterThan(1.4, 0.0, "paramName")); 41exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfGreaterThan(double.NaN, 0.0, "paramName")); 49var exception = Record.Exception(() => Throw.IfGreaterThan(0.0, 0.0, "paramName")); 57var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfLessThanOrEqual(TestValue, TestValue, "paramName")); 61exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfLessThanOrEqual(double.NaN, TestValue, "paramName")); 69var exception = Record.Exception(() => Throw.IfLessThanOrEqual(1.5, 0.0, "paramName")); 77var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfGreaterThanOrEqual(TestValue, TestValue, "paramName")); 81exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfGreaterThanOrEqual(double.NaN, TestValue, "paramName")); 89var exception = Record.Exception(() => Throw.IfGreaterThanOrEqual(0.0, 1.3, "paramName")); 98var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfZero(zero, "paramName")); 110var exception = Record.Exception(() => Throw.IfZero(notZero, "paramName")); 117var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfOutOfRange(-1.0, 0, 1, "foo")); 121exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfOutOfRange(2.0, 0, 1, "foo")); 125Assert.Equal(0, Throw.IfOutOfRange(0.0, 0, 1, "foo")); 126Assert.Equal(1, Throw.IfOutOfRange(1.0, 0, 1, "foo")); 128exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfOutOfRange(double.NaN, 0, 1, "foo")); 138var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfGreaterThan(Zero, -1)); 140var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfGreaterThan(Zero, -1, nameof(Zero))); 151var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfGreaterThanOrEqual(Zero, -1)); 153var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfGreaterThanOrEqual(Zero, -1, nameof(Zero))); 164var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfLessThan(Zero, 1)); 166var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfLessThan(Zero, 1, nameof(Zero))); 177var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfLessThanOrEqual(Zero, 1)); 179var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfLessThanOrEqual(Zero, 1, nameof(Zero))); 190var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfZero(Zero)); 192var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfZero(Zero, nameof(Zero))); 203var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfOutOfRange(Zero, 1, 2)); 205var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfOutOfRange(Zero, 1, 2, nameof(Zero)));
Throw\IntegerTests.cs (52)
18var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfLessThan(0, 1, "paramName")); 26var exception = Record.Exception(() => Throw.IfLessThan(0, 0, "paramName")); 33var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfGreaterThan(1, 0, "paramName")); 41var exception = Record.Exception(() => Throw.IfGreaterThan(0, 0, "paramName")); 48var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfLessThanOrEqual(1, 1, "paramName")); 56var exception = Record.Exception(() => Throw.IfLessThanOrEqual(1, 0, "paramName")); 63var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfGreaterThanOrEqual(1, 1, "paramName")); 71var exception = Record.Exception(() => Throw.IfGreaterThanOrEqual(0, 1, "paramName")); 78var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfZero(0, "paramName")); 86var exception = Record.Exception(() => Throw.IfZero(1, "paramName")); 93var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfOutOfRange(-1, 0, 1, "foo")); 97exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfOutOfRange(2, 0, 1, "foo")); 101Assert.Equal(0, Throw.IfOutOfRange(0, 0, 1, "foo")); 102Assert.Equal(1, Throw.IfOutOfRange(1, 0, 1, "foo")); 110var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfGreaterThan(Zero, -1)); 112var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfGreaterThan(Zero, -1, nameof(Zero))); 123var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfGreaterThanOrEqual(Zero, -1)); 125var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfGreaterThanOrEqual(Zero, -1, nameof(Zero))); 136var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfLessThan(Zero, 1)); 138var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfLessThan(Zero, 1, nameof(Zero))); 149var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfLessThanOrEqual(Zero, 1)); 151var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfLessThanOrEqual(Zero, 1, nameof(Zero))); 162var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfZero(Zero)); 164var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfZero(Zero, nameof(Zero))); 175var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfOutOfRange(Zero, 1, 2)); 177var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfOutOfRange(Zero, 1, 2, nameof(Zero))); 190var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfLessThan(0U, 1U, "paramName")); 198var exception = Record.Exception(() => Throw.IfLessThan(0U, 0U, "paramName")); 205var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfGreaterThan(1U, 0U, "paramName")); 213var exception = Record.Exception(() => Throw.IfGreaterThan(0U, 0U, "paramName")); 220var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfLessThanOrEqual(1U, 1U, "paramName")); 228var exception = Record.Exception(() => Throw.IfLessThanOrEqual(1U, 0U, "paramName")); 235var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfGreaterThanOrEqual(1U, 1U, "paramName")); 243var exception = Record.Exception(() => Throw.IfGreaterThanOrEqual(0U, 1U, "paramName")); 250var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfZero(0U, "paramName")); 258var exception = Record.Exception(() => Throw.IfZero(1U, "paramName")); 265var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfOutOfRange(0U, 1, 2, "foo")); 269exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfOutOfRange(2U, 0U, 1U, "foo")); 273Assert.Equal(0U, Throw.IfOutOfRange(0U, 0, 1, "foo")); 274Assert.Equal(1U, Throw.IfOutOfRange(1U, 0, 1, "foo")); 282var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfGreaterThan(One, 0U)); 284var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfGreaterThan(One, 0U, nameof(One))); 295var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfGreaterThanOrEqual(One, 0U)); 297var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfGreaterThanOrEqual(One, 0U, nameof(One))); 308var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfLessThan(Zero, 1U)); 310var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfLessThan(Zero, 1U, nameof(Zero))); 321var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfLessThanOrEqual(Zero, 1U)); 323var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfLessThanOrEqual(Zero, 1U, nameof(Zero))); 334var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfZero(Zero)); 336var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfZero(Zero, nameof(Zero))); 347var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfOutOfRange(Zero, 1U, 2U)); 349var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfOutOfRange(Zero, 1U, 2U, nameof(Zero)));
Throw\LongTests.cs (52)
18var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfLessThan(0L, 1L, "paramName")); 26var exception = Record.Exception(() => Throw.IfLessThan(0L, 0L, "paramName")); 33var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfGreaterThan(1L, 0L, "paramName")); 41var exception = Record.Exception(() => Throw.IfGreaterThan(0L, 0L, "paramName")); 48var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfLessThanOrEqual(1L, 1L, "paramName")); 56var exception = Record.Exception(() => Throw.IfLessThanOrEqual(1L, 0L, "paramName")); 63var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfGreaterThanOrEqual(1L, 1L, "paramName")); 71var exception = Record.Exception(() => Throw.IfGreaterThanOrEqual(0L, 1L, "paramName")); 78var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfZero(0L, "paramName")); 86var exception = Record.Exception(() => Throw.IfZero(1L, "paramName")); 93var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfOutOfRange(-1L, 0, 1, "foo")); 97exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfOutOfRange(2L, 0, 1, "foo")); 101Assert.Equal(0, Throw.IfOutOfRange(0L, 0, 1, "foo")); 102Assert.Equal(1, Throw.IfOutOfRange(1L, 0, 1, "foo")); 110var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfGreaterThan(Zero, -1)); 112var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfGreaterThan(Zero, -1, nameof(Zero))); 123var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfGreaterThanOrEqual(Zero, -1)); 125var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfGreaterThanOrEqual(Zero, -1, nameof(Zero))); 136var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfLessThan(Zero, 1)); 138var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfLessThan(Zero, 1, nameof(Zero))); 149var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfLessThanOrEqual(Zero, 1)); 151var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfLessThanOrEqual(Zero, 1, nameof(Zero))); 162var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfZero(Zero)); 164var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfZero(Zero, nameof(Zero))); 175var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfOutOfRange(Zero, 1, 2)); 177var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfOutOfRange(Zero, 1, 2, nameof(Zero))); 190var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfLessThan(0UL, 1UL, "paramName")); 198var exception = Record.Exception(() => Throw.IfLessThan(0UL, 0UL, "paramName")); 205var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfGreaterThan(1UL, 0UL, "paramName")); 213var exception = Record.Exception(() => Throw.IfGreaterThan(0UL, 0UL, "paramName")); 220var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfLessThanOrEqual(1UL, 1UL, "paramName")); 228var exception = Record.Exception(() => Throw.IfLessThanOrEqual(1UL, 0UL, "paramName")); 235var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfGreaterThanOrEqual(1UL, 1UL, "paramName")); 243var exception = Record.Exception(() => Throw.IfGreaterThanOrEqual(0UL, 1UL, "paramName")); 250var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfZero(0UL, "paramName")); 258var exception = Record.Exception(() => Throw.IfZero(1UL, "paramName")); 265var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfOutOfRange(0UL, 1UL, 2UL, "foo")); 269exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfOutOfRange(2L, 0UL, 1UL, "foo")); 273Assert.Equal(0UL, Throw.IfOutOfRange(0UL, 0, 1, "foo")); 274Assert.Equal(1UL, Throw.IfOutOfRange(1UL, 0, 1, "foo")); 282var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfGreaterThan(One, 0UL)); 284var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfGreaterThan(One, 0UL, nameof(One))); 295var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfGreaterThanOrEqual(One, 0UL)); 297var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfGreaterThanOrEqual(One, 0UL, nameof(One))); 308var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfLessThan(Zero, 1UL)); 310var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfLessThan(Zero, 1UL, nameof(Zero))); 321var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfLessThanOrEqual(Zero, 1UL)); 323var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfLessThanOrEqual(Zero, 1UL, nameof(Zero))); 334var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfZero(Zero)); 336var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfZero(Zero, nameof(Zero))); 347var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfOutOfRange(Zero, 1UL, 2UL)); 349var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfOutOfRange(Zero, 1UL, 2UL, nameof(Zero)));
Throw\ThrowTest.cs (59)
20var exception = Assert.Throws<InvalidOperationException>(() => Throw.InvalidOperationException(message)); 31var exception = Assert.Throws<InvalidOperationException>(() => Throw.InvalidOperationException(message, innerException)); 41var exception = Assert.Throws<ArgumentException>(() => Throw.ArgumentException(paramName, message)); 54var exception = Assert.Throws<ArgumentException>(() => Throw.ArgumentException(paramName, message, innerException)); 64var exception = Assert.Throws<ArgumentNullException>(() => Throw.ArgumentNullException(paramName)); 73var exception = Assert.Throws<ArgumentNullException>(() => Throw.ArgumentNullException(paramName, message)); 82var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.ArgumentOutOfRangeException(paramName)); 91var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.ArgumentOutOfRangeException(paramName, message)); 103var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.ArgumentOutOfRangeException(paramName, actualValue, message)); 116var exception = Assert.Throws<ArgumentNullException>(() => Throw.IfNull<string>(null!, "paramName")); 123var exception = Assert.Throws<ArgumentNullException>(() => Throw.IfNull<int?>(null!, "paramName")); 131Assert.Equal(value, Throw.IfNull(value, nameof(value))); 138Assert.Equal(value, Throw.IfNull(value, nameof(value))); 146var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfNull(somethingThatIsNull)); 148var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfNull(somethingThatIsNull, nameof(somethingThatIsNull))); 161var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfNullOrMemberNull(somethingThatIsNull, somethingNestedThatIsNull)); 164() => Throw.IfNullOrMemberNull(somethingThatIsNull, somethingNestedThatIsNull, nameof(somethingThatIsNull), nameof(somethingNestedThatIsNull))); 177var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfNullOrMemberNull(red, somethingNestedThatIsNull)); 180() => Throw.IfNullOrMemberNull(red, somethingNestedThatIsNull, nameof(red), nameof(somethingNestedThatIsNull))); 193exceptionImplicitArgumentName = Record.Exception(() => Throw.IfMemberNull(somethingThatIsNotNull, somethingNestedThatIsNull)); 196() => Throw.IfMemberNull(somethingThatIsNotNull, somethingNestedThatIsNull, nameof(somethingThatIsNotNull), nameof(somethingNestedThatIsNull))); 216var exception = Record.Exception(() => Throw.IfNullOrMemberNull(red, blue)); 219var resultOfThrows = Throw.IfNullOrMemberNull(red, blue); 222resultOfThrows = Throw.IfMemberNull(red, blue); 232var exception = Assert.Throws<ArgumentNullException>(() => Throw.IfNullOrWhitespace(null!, "paramName")); 239var exception = Assert.Throws<ArgumentException>(() => Throw.IfNullOrWhitespace(" ", "paramName")); 247var exception = Record.Exception(() => Throw.IfNullOrWhitespace("param", "paramName")); 254var exception = Assert.Throws<ArgumentNullException>(() => Throw.IfNullOrEmpty(null, "paramName")); 261var exception = Assert.Throws<ArgumentException>(() => Throw.IfNullOrEmpty("", "paramName")); 269var exception = Record.Exception(() => Throw.IfNullOrEmpty("param", "paramName")); 278var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfNullOrWhitespace(somethingThatIsNull)); 280var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfNullOrWhitespace(somethingThatIsNull, nameof(somethingThatIsNull))); 291var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfNullOrEmpty(somethingThatIsNull)); 293var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfNullOrEmpty(somethingThatIsNull, nameof(somethingThatIsNull))); 306var exception = Assert.Throws<ArgumentException>(() => Throw.IfBufferTooSmall(23, 24, "paramName")); 314var exception = Record.Exception(() => Throw.IfBufferTooSmall(23, 23, "paramName")); 334ArgumentException exception = Assert.Throws<ArgumentNullException>(() => Throw.IfNullOrEmpty((ICollection<int>?)null, "foo")); 337exception = Assert.Throws<ArgumentNullException>(() => Throw.IfNullOrEmpty((IReadOnlyCollection<int>?)null, "foo")); 340exception = Assert.Throws<ArgumentNullException>(() => Throw.IfNullOrEmpty((List<int>?)null, "foo")); 343exception = Assert.Throws<ArgumentNullException>(() => Throw.IfNullOrEmpty((Queue<int>?)null, "foo")); 346exception = Assert.Throws<ArgumentNullException>(() => Throw.IfNullOrEmpty((IEnumerable<int>?)null, "foo")); 351exception = Assert.Throws<ArgumentException>(() => Throw.IfNullOrEmpty((ICollection<int>?)list, "foo")); 355exception = Assert.Throws<ArgumentException>(() => Throw.IfNullOrEmpty((IReadOnlyCollection<int>?)list, "foo")); 359exception = Assert.Throws<ArgumentException>(() => Throw.IfNullOrEmpty(list, "foo")); 365exception = Assert.Throws<ArgumentException>(() => Throw.IfNullOrEmpty(queue, "foo")); 371exception = Assert.Throws<ArgumentException>(() => Throw.IfNullOrEmpty(enumerable, "foo")); 376Assert.Equal(list, Throw.IfNullOrEmpty((ICollection<int>?)list, "foo")); 377Assert.Equal(list, Throw.IfNullOrEmpty((IReadOnlyCollection<int>?)list, "foo")); 378Assert.Equal(list, Throw.IfNullOrEmpty(list, "foo")); 381Assert.Equal(queue, Throw.IfNullOrEmpty(queue, "foo")); 384Assert.Equal(enumerable, Throw.IfNullOrEmpty(enumerable, "foo")); 392var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfNullOrEmpty(listButActuallyNull!)); 412Assert.Equal(Color.Red, Throw.IfOutOfRange(Color.Red, "foo")); 413Assert.Equal(Color.Green, Throw.IfOutOfRange(Color.Green, "foo")); 414Assert.Equal(Color.Blue, Throw.IfOutOfRange(Color.Blue, "foo")); 416var exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfOutOfRange((Color)(-1), "foo")); 420exception = Assert.Throws<ArgumentOutOfRangeException>(() => Throw.IfOutOfRange((Color)3, "foo")); 430var exceptionImplicitArgumentName = Record.Exception(() => Throw.IfOutOfRange((Color)colorButNull!)); 432var exceptionExplicitArgumentName = Record.Exception(() => Throw.IfOutOfRange((Color)colorButNull!, nameof(colorButNull)));