<commit_before>﻿using Ipfs.Api;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json.Linq;
using System;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Ipfs.Api
{

    [TestClass]
    public class NameApiTest
    {

        [TestMethod]
        public void Api_Exists()
        {
            IpfsClient ipfs = TestFixture.Ipfs;
            Assert.IsNotNull(ipfs.Name);
        }

        [TestMethod]
        public async Task Resolve()
        {
            IpfsClient ipfs = TestFixture.Ipfs;
            var id = await ipfs.Name.ResolveAsync("ipfs.io");
            Assert.IsNotNull(id);
        }

        [TestMethod]
        public async Task Publish()
        {
            var ipfs = TestFixture.Ipfs;
            var cs = new CancellationTokenSource(TimeSpan.FromMinutes(2));
            var content = await ipfs.FileSystem.AddTextAsync("hello world");
            var key = await ipfs.Key.CreateAsync("name-publish-test", "rsa", 1024);
            try
            {
                var result = await ipfs.Name.PublishAsync(content.Id, key.Name, cancel: cs.Token);
                Assert.IsNotNull(result);
                StringAssert.EndsWith(result.NamePath, key.Id.ToString());
                StringAssert.EndsWith(result.ContentPath, content.Id.Encode());
            }
            finally
            {
                await ipfs.Key.RemoveAsync(key.Name);
            }
        }

    }
}<commit_msg>test(NameApi): more time for publish<commit_after>﻿using Ipfs.Api;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json.Linq;
using System;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Ipfs.Api
{

    [TestClass]
    public class NameApiTest
    {

        [TestMethod]
        public void Api_Exists()
        {
            IpfsClient ipfs = TestFixture.Ipfs;
            Assert.IsNotNull(ipfs.Name);
        }

        [TestMethod]
        public async Task Resolve()
        {
            IpfsClient ipfs = TestFixture.Ipfs;
            var id = await ipfs.Name.ResolveAsync("ipfs.io");
            Assert.IsNotNull(id);
        }

        [TestMethod]
        public async Task Publish()
        {
            var ipfs = TestFixture.Ipfs;
            var cs = new CancellationTokenSource(TimeSpan.FromMinutes(5));
            var content = await ipfs.FileSystem.AddTextAsync("hello world");
            var key = await ipfs.Key.CreateAsync("name-publish-test", "rsa", 1024);
            try
            {
                var result = await ipfs.Name.PublishAsync(content.Id, key.Name, cancel: cs.Token);
                Assert.IsNotNull(result);
                StringAssert.EndsWith(result.NamePath, key.Id.ToString());
                StringAssert.EndsWith(result.ContentPath, content.Id.Encode());
            }
            finally
            {
                await ipfs.Key.RemoveAsync(key.Name);
            }
        }

    }
}
{'fraction_non_alphanumeric': 0.10056422170594093, 'fraction_numerical': 0.003318951211417192, 'mean_word_length': 1.8514664143803217, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '2460330', 'n_tokens_mistral': 871, 'n_tokens_neox': 861, 'n_words': 168}