IsEmpty.cs 746 B

12345678910111213141516171819202122232425262728293031
  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.Linq;
  6. using Xunit;
  7. namespace Tests
  8. {
  9. public class IsEmpty : Tests
  10. {
  11. [Fact]
  12. public void IsEmtpy_Arguments()
  13. {
  14. AssertThrows<ArgumentNullException>(() => EnumerableEx.IsEmpty<int>(null));
  15. }
  16. [Fact]
  17. public void IsEmpty_Empty()
  18. {
  19. Assert.True(Enumerable.Empty<int>().IsEmpty());
  20. }
  21. [Fact]
  22. public void IsEmpty_NonEmpty()
  23. {
  24. Assert.False(new[] { 1 }.IsEmpty());
  25. }
  26. }
  27. }