IsEmptyTest.cs 803 B

123456789101112131415161718192021222324252627282930313233
  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 IsEmptyTest : Tests
  12. {
  13. [Fact]
  14. public void IsEmtpy_Arguments()
  15. {
  16. AssertThrows<ArgumentNullException>(() => EnumerableEx.IsEmpty<int>(null));
  17. }
  18. [Fact]
  19. public void IsEmpty_Empty()
  20. {
  21. Assert.True(Enumerable.Empty<int>().IsEmpty());
  22. }
  23. [Fact]
  24. public void IsEmpty_NonEmpty()
  25. {
  26. Assert.False(new[] { 1 }.IsEmpty());
  27. }
  28. }
  29. }