<commit_before>// Copyright (c) Dapplo and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Globalization;
using System.Threading;
using Dapplo.HttpExtensions;
using Dapplo.HttpExtensions.ContentConverter;
using Dapplo.HttpExtensions.Extensions;
using Dapplo.Log;
using Dapplo.Log.XUnit;
using Xunit.Abstractions;

namespace Dapplo.Jira.Tests
{
    /// <summary>
    ///     Abstract base class for all tests
    /// </summary>
    public abstract class TestBase
    {
        protected static readonly LogSource Log = new();
        protected const string TestProjectKey = "DIT";
        protected const string TestIssueKey = "DIT-1";
        protected const string TestIssueKey2 = "DIT-123";

        // Test against a well known JIRA
        protected static readonly Uri TestJiraUri = new Uri("https://greenshot.atlassian.net");

        /// <summary>
        ///     Default test setup, can also take care of setting the authentication
        /// </summary>
        /// <param name="testOutputHelper">ITestOutputHelper</param>
        /// <param name="doLogin">bool</param>
        protected TestBase(ITestOutputHelper testOutputHelper, bool doLogin = true)
        {
            var ci = new CultureInfo("en-US");
            Thread.CurrentThread.CurrentCulture = ci;
            Thread.CurrentThread.CurrentUICulture = ci;

            var defaultJsonHttpContentConverterConfiguration = new DefaultJsonHttpContentConverterConfiguration
            {
                LogThreshold = 0
            };
            HttpBehaviour.Current.SetConfig(defaultJsonHttpContentConverterConfiguration);

            LogSettings.RegisterDefaultLogger<XUnitLogger>(LogLevels.Verbose, testOutputHelper);
            Client = JiraClient.Create(TestJiraUri);
            Username = Environment.GetEnvironmentVariable("jira_test_username");
            Password = Environment.GetEnvironmentVariable("jira_test_password");

            if (doLogin && !string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password))
            {
                Client.SetBasicAuthentication(Username, Password);
            }
        }

        /// <summary>
        ///     The instance of the JiraClient
        /// </summary>
        protected IJiraClient Client { get; }

        protected string Username { get; }
        protected string Password { get; }
    }
}
<commit_msg>Fix for logging issue, due to a new() vs new LogSource()<commit_after>// Copyright (c) Dapplo and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Globalization;
using System.Threading;
using Dapplo.HttpExtensions;
using Dapplo.HttpExtensions.ContentConverter;
using Dapplo.HttpExtensions.Extensions;
using Dapplo.Log;
using Dapplo.Log.XUnit;
using Xunit.Abstractions;

namespace Dapplo.Jira.Tests
{
    /// <summary>
    ///     Abstract base class for all tests
    /// </summary>
    public abstract class TestBase
    {
        protected static readonly LogSource Log = new LogSource();
        protected const string TestProjectKey = "DIT";
        protected const string TestIssueKey = "DIT-1";
        protected const string TestIssueKey2 = "DIT-123";

        // Test against a well known JIRA
        protected static readonly Uri TestJiraUri = new Uri("https://greenshot.atlassian.net");

        /// <summary>
        ///     Default test setup, can also take care of setting the authentication
        /// </summary>
        /// <param name="testOutputHelper">ITestOutputHelper</param>
        /// <param name="doLogin">bool</param>
        protected TestBase(ITestOutputHelper testOutputHelper, bool doLogin = true)
        {
            var ci = new CultureInfo("en-US");
            Thread.CurrentThread.CurrentCulture = ci;
            Thread.CurrentThread.CurrentUICulture = ci;

            var defaultJsonHttpContentConverterConfiguration = new DefaultJsonHttpContentConverterConfiguration
            {
                LogThreshold = 0
            };
            HttpBehaviour.Current.SetConfig(defaultJsonHttpContentConverterConfiguration);

            LogSettings.RegisterDefaultLogger<XUnitLogger>(LogLevels.Verbose, testOutputHelper);
            Client = JiraClient.Create(TestJiraUri);
            Username = Environment.GetEnvironmentVariable("jira_test_username");
            Password = Environment.GetEnvironmentVariable("jira_test_password");

            if (doLogin && !string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password))
            {
                Client.SetBasicAuthentication(Username, Password);
            }
        }

        /// <summary>
        ///     The instance of the JiraClient
        /// </summary>
        protected IJiraClient Client { get; }

        protected string Username { get; }
        protected string Password { get; }
    }
}

{'fraction_non_alphanumeric': 0.09021804360872174, 'fraction_numerical': 0.002400480096019204, 'mean_word_length': 2.5714285714285716, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 2, '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': '3497865', 'n_tokens_mistral': 1277, 'n_tokens_neox': 1234, 'n_words': 335}