﻿using GitLabSharp.Client.IntegrationTests.Infrastructure;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace GitLabSharp.Client.Tests
{
    public abstract class GitLabTestBase
    {
        protected GitLabSharpClient CreateClient()
        {
            var appSettings = new AppSettings();
            var config = new ConfigurationBuilder()
                .SetBasePath(Directory.GetCurrentDirectory())
                .AddJsonFile("appsettings.json")
                .Build();

            config.GetSection("AppSettings").Bind(appSettings);

            return new GitLabSharpClient(appSettings.Url, appSettings.Token);
        }
    }
}
