SelectMany.cs 868 B

123456789101112131415161718192021222324252627
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT License.
  3. // See the LICENSE file in the project root for more information.
  4. using System;
  5. using System.Linq;
  6. using Xunit;
  7. namespace Tests
  8. {
  9. public class SelectMany : Tests
  10. {
  11. [Fact]
  12. public void SelectMany_Arguments()
  13. {
  14. AssertThrows<ArgumentNullException>(() => EnumerableEx.SelectMany<int, int>(null, new[] { 1 }));
  15. AssertThrows<ArgumentNullException>(() => EnumerableEx.SelectMany<int, int>(new[] { 1 }, null));
  16. }
  17. [Fact]
  18. public void SelectMany1()
  19. {
  20. var res = new[] { 1, 2 }.SelectMany(new[] { 'a', 'b', 'c' }).ToList();
  21. Assert.True(Enumerable.SequenceEqual(res, new[] { 'a', 'b', 'c', 'a', 'b', 'c' }));
  22. }
  23. }
  24. }