SelectManyTest.cs 911 B

123456789101112131415161718192021222324252627
  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.Linq;
  7. using Xunit;
  8. namespace Tests
  9. {
  10. public class SelectManyTest : Tests
  11. {
  12. [Fact]
  13. public void SelectMany_Arguments()
  14. {
  15. AssertThrows<ArgumentNullException>(() => EnumerableEx.SelectMany<int, int>(null, new[] { 1 }));
  16. AssertThrows<ArgumentNullException>(() => EnumerableEx.SelectMany<int, int>(new[] { 1 }, null));
  17. }
  18. [Fact]
  19. public void SelectMany()
  20. {
  21. var res = new[] { 1, 2 }.SelectMany(new[] { 'a', 'b', 'c' }).ToList();
  22. Assert.True(Enumerable.SequenceEqual(res, new[] { 'a', 'b', 'c', 'a', 'b', 'c' }));
  23. }
  24. }
  25. }