IgnoreElementsTest.cs 790 B

1234567891011121314151617181920212223242526272829
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the Apache 2.0 License.
  3. // See the LICENSE file in the project root for more information.
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Text;
  7. using System.Linq;
  8. using Xunit;
  9. namespace Tests
  10. {
  11. public class IgnoreElementsTest : Tests
  12. {
  13. [Fact]
  14. public void IgnoreElements_Arguments()
  15. {
  16. AssertThrows<ArgumentNullException>(() => EnumerableEx.IgnoreElements<int>(null));
  17. }
  18. [Fact]
  19. public void IgnoreElements()
  20. {
  21. var n = 0;
  22. Enumerable.Range(0, 10).Do(_ => n++).IgnoreElements().Take(5).ForEach(_ => { });
  23. Assert.Equal(10, n);
  24. }
  25. }
  26. }