using Adaptation.Shared.Methods;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Shared;
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;

namespace _Tests.CreateSelfDescription.Staging.v2_39_0;

[TestClass]
public class R34 : EAFLoggingUnitTesting
{

#pragma warning disable CA2254
#pragma warning disable IDE0060

    internal static R34 EAFLoggingUnitTesting { get; private set; }

    public R34() : base(testContext: null, declaringType: null, skipEquipmentDictionary: false)
    {
        if (EAFLoggingUnitTesting is null)
            throw new Exception();
    }

    public R34(TestContext testContext) : base(testContext, new StackFrame().GetMethod().DeclaringType, skipEquipmentDictionary: false)
    {
    }

    [ClassInitialize]
    public static void ClassInitialize(TestContext testContext)
    {
        if (EAFLoggingUnitTesting is null)
            EAFLoggingUnitTesting = new R34(testContext);
        EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(testContext.TestName, " - ClassInitialize"));
        string[] fileNameAndText = EAFLoggingUnitTesting.AdaptationTesting.GetCSharpText(testContext.TestName);
        File.WriteAllText(fileNameAndText[0], fileNameAndText[1]);
        File.WriteAllText(fileNameAndText[2], fileNameAndText[3]);
    }

    [ClassCleanup()]
    public static void ClassCleanup()
    {
        if (EAFLoggingUnitTesting.Logger is not null)
            EAFLoggingUnitTesting.Logger.LogInformation("Cleanup");
        if (EAFLoggingUnitTesting is not null)
            EAFLoggingUnitTesting.Dispose();
    }

    [TestMethod]
    public void Staging__v2_39_0__R34__jpeg()
    {
        string check = "*.jpeg";
        MethodBase methodBase = new StackFrame().GetMethod();
        EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
        _ = Helpers.Deposition.GetWriteConfigurationGetFileRead(methodBase, check, EAFLoggingUnitTesting.AdaptationTesting);
        EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
    }

}