Skip to content

Commit

Permalink
SkipLast
Browse files Browse the repository at this point in the history
  • Loading branch information
atifaziz committed Dec 29, 2024
1 parent e51b466 commit 59818a3
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions MoreLinq.Test/SkipLastTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public class SkipLastTest
[TestCase(-1)]
public void SkipLastWithCountLesserThanOne(int skip)
{
var numbers = Enumerable.Range(1, 5);

Assert.That(numbers.SkipLast(skip), Is.EqualTo(numbers));
using var numbers = Enumerable.Range(1, 5).AsTestingSequence();
var result = numbers.SkipLast(skip);
Assert.That(result, Is.EqualTo(numbers));
}

[Test]
Expand All @@ -40,17 +40,20 @@ public void SkipLast()
const int skip = 20;

var sequence = Enumerable.Range(1, take);

var expectations = sequence.Take(take - skip);

Assert.That(expectations, Is.EqualTo(sequence.SkipLast(skip)));
using var source = sequence.AsTestingSequence();
var result = source.SkipLast(skip);
Assert.That(expectations, Is.EqualTo(result));
}

[TestCase(5)]
[TestCase(6)]
public void SkipLastWithSequenceShorterThanCount(int skip)
{
Assert.That(Enumerable.Range(1, 5).SkipLast(skip), Is.Empty);
using var source = Enumerable.Range(1, 5).AsTestingSequence();
var result = source.SkipLast(skip);
Assert.That(result, Is.Empty);
}

[Test]
Expand Down

0 comments on commit 59818a3

Please sign in to comment.