<commit_before>﻿namespace Skeleton.Common.Tests.Extensions
{
    using System.Collections.Generic;
    using System.Linq;
    using Common.Extensions;
    using JetBrains.Annotations;
    using Xunit;

    public class EnumerableExtensionsTests
    {
        [UsedImplicitly]
        public static IEnumerable<object[]> IsEmptyExtensionTests;
        [UsedImplicitly]
        public static IEnumerable<object[]> IsNotEmptyExtensionTests;
        [UsedImplicitly]
        public static IEnumerable<object[]> IsEqualsExtensionTests;

        static EnumerableExtensionsTests()
        {
            IsEmptyExtensionTests = new[]
                                    {
                                        new object[] {null, true},
                                        new object[] {Enumerable.Empty<int>(), true},
                                        new object[] {Enumerable.Repeat(1, 2), false}
                                    };
            IsNotEmptyExtensionTests = new[]
                                       {
                                           new object[] {null, false},
                                           new object[] {Enumerable.Empty<int>(), false},
                                           new object[] {Enumerable.Repeat(1, 2), true}
                                       };
            IsEqualsExtensionTests = new[]
                                     {
                                         new object[] {null, null, true},
                                         new object[] {Enumerable.Empty<int>(), Enumerable.Empty<int>(), true},
                                         new object[] {null, Enumerable.Empty<int>(), false},
                                         new object[] {Enumerable.Empty<int>(), null, false},
                                         new object[] {Enumerable.Empty<int>(), Enumerable.Repeat(1, 2), false},
                                         new object[] {Enumerable.Repeat(1, 2), Enumerable.Repeat(1, 2), true}
                                     };
        }

        [Theory]
        [MemberData(nameof(IsEmptyExtensionTests))]
        public void ShouldCheckCollectionsForEmptiness(IEnumerable<int> source, bool expected)
        {
            Assert.Equal(expected, source.IsEmpty());
        }

        [Theory]
        [MemberData(nameof(IsNotEmptyExtensionTests))]
        public void ShouldCheckCollectionsForNotEmptiness(IEnumerable<int> source, bool expected)
        {
            Assert.Equal(expected, source.IsNotEmpty());
        }

        [Theory]
        [MemberData(nameof(IsEqualsExtensionTests))]<commit_msg>Tests for AsArray extension were added<commit_after>﻿namespace Skeleton.Common.Tests.Extensions
{
    using System.Collections.Generic;
    using System.Linq;
    using Common.Extensions;
    using JetBrains.Annotations;
    using Xunit;

    public class EnumerableExtensionsTests
    {
        [UsedImplicitly]
        public static IEnumerable<object[]> IsEmptyExtensionTests;
        [UsedImplicitly]
        public static IEnumerable<object[]> IsNotEmptyExtensionTests;
        [UsedImplicitly]
        public static IEnumerable<object[]> AsArrayExtensionTests;
        [UsedImplicitly]
        public static IEnumerable<object[]> IsEqualsExtensionTests;

        static EnumerableExtensionsTests()
        {
            IsEmptyExtensionTests = new[]
                                    {
                                        new object[] {null, true},
                                        new object[] {Enumerable.Empty<int>(), true},
                                        new object[] {Enumerable.Repeat(1, 2), false}
                                    };
            IsNotEmptyExtensionTests = new[]
                                       {
                                           new object[] {null, false},
                                           new object[] {Enumerable.Empty<int>(), false},
                                           new object[] {Enumerable.Repeat(1, 2), true}
                                       };
            var arrayForTesting = new[] {1, 2, 3, 4, 5};
            AsArrayExtensionTests = new[]
                                    {
                                        new object[] {null, new int[0]},
                                        new object[] {Enumerable.Range(1, 3), new[] {1, 2, 3}},
                                        new object[] {arrayForTesting, arrayForTesting}
                                    };
            IsEqualsExtensionTests = new[]
                                     {
                                         new object[] {null, null, true},
                                         new object[] {Enumerable.Empty<int>(), Enumerable.Empty<int>(), true},
                                         new object[] {null, Enumerable.Empty<int>(), false},
                                         new object[] {Enumerable.Empty<int>(), null, false},
                                         new object[] {Enumerable.Empty<int>(), Enumerable.Repeat(1, 2), false},
                                         new object[] {Enumerable.Repeat(1, 2), Enumerable.Repeat(1, 2), true}
                                     };
        }

        [Theory]
        [MemberData(nameof(IsEmptyExtensionTests))]
        public void ShouldCheckCollectionsForEmptiness(IEnumerable<int> source, bool expected)
        {
            Assert.Equal(expected, source.IsEmpty());
        }

        [Theory]
        [MemberData(nameof(IsNotEmptyExtensionTests))]
        public void ShouldCheckCollectionsForNotEmptiness(IEnumerable<int> source, bool expected)
        {
            Assert.Equal(expected, source.IsNotEmpty());
        }

        [Theory]
        [MemberData(nameof(AsArrayExtensionTests))]
        public void ShouldCheckEnumerableToArrayConversion(IEnumerable<int> source, int[] expected)
        {
            Assert.Equal(expected, source.AsArray());
        }

        [Theory]
        [MemberData(nameof(IsEqualsExtensionTests))]
{'fraction_non_alphanumeric': 0.09433023872679044, 'fraction_numerical': 0.005139257294429708, 'mean_word_length': 1.3026717557251908, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 68, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4630760', 'n_tokens_mistral': 1329, 'n_tokens_neox': 1274, 'n_words': 284}