<commit_before>﻿using System;
using System.Threading.Tasks;
using NSubstitute;
using Xunit;

namespace Octokit.Tests.Clients
{
    public class MetaClientTests
    {
        public class TheGetMetadataMethod
        {
            [Fact]
            public async Task RequestsTheMetadataEndpoint()
            {
                var meta = new Meta(
                     false,
                     "12345ABCDE",
                     new[] { "1.1.1.1/24", "1.1.1.2/24" },
                     new[] { "1.1.2.1/24", "1.1.2.2/24" },
                     new[] { "1.1.3.1/24", "1.1.3.2/24" },
                     new[] { "1.1.4.1", "1.1.4.2" }
                 );

                var apiConnection = Substitute.For<IApiConnection>();
                apiConnection.Get<Meta>(Arg.Is<Uri>(u => u.ToString() == "meta")).Returns(Task.FromResult(meta));
                var client = new MetaClient(apiConnection);

                var result = await client.GetMetadata();

                Assert.False(result.VerifiablePasswordAuthentication);
                Assert.Equal("12345ABCDE", result.GitHubServicesSha);
                Assert.Equal(result.Hooks, new[] { "1.1.1.1/24", "1.1.1.2/24" });
                Assert.Equal(result.Git, new[] { "1.1.2.1/24", "1.1.2.2/24" });
                Assert.Equal(result.Pages, new[] { "1.1.3.1/24", "1.1.3.2/24" });
                Assert.Equal(result.Importer, new[] { "1.1.4.1", "1.1.4.2" });

                apiConnection.Received()
                    .Get<Meta>(Arg.Is<Uri>(u => u.ToString() == "meta"));
            }
        }

        public class TheCtor
        {
            [Fact]
            public void EnsuresNonNullArguments()
            {
                Assert.Throws<ArgumentNullException>(() => new MetaClient(null));
            }
        }
    }
}<commit_msg>updates tests to include new fields for the meta resource (#2581)<commit_after>﻿using System;
using System.Threading.Tasks;
using NSubstitute;
using Xunit;

namespace Octokit.Tests.Clients
{
    public class MetaClientTests
    {
        public class TheGetMetadataMethod
        {
            [Fact]
            public async Task RequestsTheMetadataEndpoint()
            {
                  var meta = new Meta(
                     false,
                     "12345ABCDE",
                     new[] { "1.1.1.1/24", "1.1.1.2/24" },
                     new[] { "1.1.2.1/24", "1.1.2.2/24" },
                     new[] { "1.1.3.1/24", "1.1.3.2/24" },
                     new[] { "1.1.4.1/24", "1.1.4.2/24" },
                     new[] { "1.1.5.1/24", "1.1.5.2/24" },
                     new[] { "1.1.6.1/24", "1.1.6.2/24" },
                     new[] { "1.1.7.1", "1.1.7.2" },
                     new[] { "1.1.8.1/24", "1.1.8.2/24" },
                     new[] { "1.1.9.1", "1.1.9.2" }
                 );


                var apiConnection = Substitute.For<IApiConnection>();
                apiConnection.Get<Meta>(Arg.Is<Uri>(u => u.ToString() == "meta")).Returns(Task.FromResult(meta));
                var client = new MetaClient(apiConnection);

                var result = await client.GetMetadata();

                Assert.False(result.VerifiablePasswordAuthentication);
                #pragma warning disable CS0618 // Type or member is obsolete
                Assert.Equal("12345ABCDE", result.GitHubServicesSha);
                #pragma warning restore CS0618 // Type or member is obsolete
                Assert.Equal(result.Hooks, new[] { "1.1.1.1/24", "1.1.1.2/24" });
                Assert.Equal(result.Web, new[] { "1.1.2.1/24", "1.1.2.2/24" });
                Assert.Equal(result.Api, new[] { "1.1.3.1/24", "1.1.3.2/24" });
                Assert.Equal(result.Git, new[] { "1.1.4.1/24", "1.1.4.2/24" });
                Assert.Equal(result.Packages, new[] { "1.1.5.1/24", "1.1.5.2/24" });
                Assert.Equal(result.Pages, new[] { "1.1.6.1/24", "1.1.6.2/24" });
                Assert.Equal(result.Importer, new[] { "1.1.7.1", "1.1.7.2" });
                Assert.Equal(result.Actions, new[] { "1.1.8.1/24", "1.1.8.2/24" });
                Assert.Equal(result.Dependabot, new[] { "1.1.9.1", "1.1.9.2" });

                apiConnection.Received()
                    .Get<Meta>(Arg.Is<Uri>(u => u.ToString() == "meta"));
            }
        }

        public class TheCtor
        {
            [Fact]
            public void EnsuresNonNullArguments()
            {
                Assert.Throws<ArgumentNullException>(() => new MetaClient(null));
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.173568281938326, 'fraction_numerical': 0.07048458149779736, 'mean_word_length': 1.4102972399150744, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 52, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '809591', 'n_tokens_mistral': 1608, 'n_tokens_neox': 1467, 'n_words': 235}