<commit_before>﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Threading;
using SharpTox.Core;

namespace SharpTox.Test
{
    [TestClass]
    public class MiscTests
    {
        private ToxOptions _options = new ToxOptions(true, true);

        [TestMethod]
        public void TestToxBootstrapAndConnect()
        {
            var tox = new Tox(_options);
            var error = ToxErrorBootstrap.Ok;

            foreach (var node in Globals.Nodes)
            {
                bool result = tox.Bootstrap(node, out error);
                if (!result || error != ToxErrorBootstrap.Ok)
                    Assert.Fail("Failed to bootstrap error: {0}, result: {1}", error, result);
            }

            tox.Start();
            while (!tox.IsConnected) { Thread.Sleep(10); }

            Console.WriteLine("Tox connected!");
            tox.Dispose();
        }

        [TestMethod]
        public void TestToxBootstrapAndConnectTcp()
        {
            var tox = new Tox(new ToxOptions(true, false));
            var error = ToxErrorBootstrap.Ok;

            bool result = tox.AddTcpRelay(new ToxNode("172.16.31.10", 443, new ToxKey(ToxKeyType.Public, "8CD087E31C67568103E8C2A28653337E90E6B8EDA0D765D57C6B5172B4F1F04C")), out error);
            if (!result || error != ToxErrorBootstrap.Ok)
                Assert.Fail("Failed to bootstrap error: {0}, result: {1}", error, result);

            tox.Start();
            while (!tox.IsConnected) { Thread.Sleep(10); }

            Console.WriteLine("Tox connected!");
            tox.Dispose();
        }
    }
}<commit_msg>Added a timeout to both of the bootstrap tests<commit_after>﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Threading;
using SharpTox.Core;

namespace SharpTox.Test
{
    [TestClass]
    public class MiscTests
    {
        private ToxOptions _options = new ToxOptions(true, true);

        [TestMethod]
        [Timeout(30000)]
        public void TestToxBootstrapAndConnect()
        {
            var tox = new Tox(_options);
            var error = ToxErrorBootstrap.Ok;

            foreach (var node in Globals.Nodes)
            {
                bool result = tox.Bootstrap(node, out error);
                if (!result || error != ToxErrorBootstrap.Ok)
                    Assert.Fail("Failed to bootstrap error: {0}, result: {1}", error, result);
            }

            tox.Start();
            while (!tox.IsConnected) { Thread.Sleep(10); }

            Console.WriteLine("Tox connected!");
            tox.Dispose();
        }

        [TestMethod]
        [Timeout(30000)]
        public void TestToxBootstrapAndConnectTcp()
        {
            var tox = new Tox(new ToxOptions(true, false));
            var error = ToxErrorBootstrap.Ok;

            bool result = tox.AddTcpRelay(new ToxNode("172.16.31.10", 443, new ToxKey(ToxKeyType.Public, "8CD087E31C67568103E8C2A28653337E90E6B8EDA0D765D57C6B5172B4F1F04C")), out error);
            if (!result || error != ToxErrorBootstrap.Ok)
                Assert.Fail("Failed to bootstrap error: {0}, result: {1}", error, result);

            tox.Start();
            while (!tox.IsConnected) { Thread.Sleep(10); }

            Console.WriteLine("Tox connected!");
            tox.Dispose();
        }
    }
}
{'fraction_non_alphanumeric': 0.11174526884950435, 'fraction_numerical': 0.04085310904175428, 'mean_word_length': 2.0861909175162188, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '4522228', 'n_tokens_mistral': 1100, 'n_tokens_neox': 977, 'n_words': 218}