From 96f53b4a3da01a52144632bd1433ad8a002816f1 Mon Sep 17 00:00:00 2001 From: Atif Aziz Date: Sat, 28 Oct 2023 15:20:43 +0200 Subject: [PATCH] Don't validate content of "Interleave" arg This is a squashed merge of PR #1031 that fixes #1029. --- MoreLinq.Test/InterleaveTest.cs | 14 -------------- MoreLinq/Interleave.cs | 2 -- 2 files changed, 16 deletions(-) diff --git a/MoreLinq.Test/InterleaveTest.cs b/MoreLinq.Test/InterleaveTest.cs index 84db32566..5d6384d8e 100644 --- a/MoreLinq.Test/InterleaveTest.cs +++ b/MoreLinq.Test/InterleaveTest.cs @@ -50,20 +50,6 @@ public void TestInterleaveDisposesOnErrorAtGetEnumerator() Throws.BreakException); } - /// - /// Verify that Interleave early throw ArgumentNullException when an element - /// of otherSequences is null. - /// - [Test] - public void TestInterleaveEarlyThrowOnNullElementInOtherSequences() - { - var sequenceA = Enumerable.Range(1, 1); - var otherSequences = new IEnumerable[] { null! }; - - Assert.That(() => sequenceA.Interleave(otherSequences), - Throws.ArgumentNullException("otherSequences")); - } - /// /// Verify that interleaving disposes those enumerators that it managed /// to open successfully diff --git a/MoreLinq/Interleave.cs b/MoreLinq/Interleave.cs index c053341d5..501a8f667 100644 --- a/MoreLinq/Interleave.cs +++ b/MoreLinq/Interleave.cs @@ -54,8 +54,6 @@ public static IEnumerable Interleave(this IEnumerable sequence, params { if (sequence == null) throw new ArgumentNullException(nameof(sequence)); if (otherSequences == null) throw new ArgumentNullException(nameof(otherSequences)); - if (otherSequences.Any(s => s == null)) - throw new ArgumentNullException(nameof(otherSequences), "One or more sequences passed to Interleave was null."); return Impl(otherSequences.Prepend(sequence));