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 DEP08SIASM : EAFLoggingUnitTesting
{

#pragma warning disable CA2254
#pragma warning disable IDE0060

    internal static DEP08SIASM EAFLoggingUnitTesting { get; private set; }

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

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

    [ClassInitialize]
    public static void ClassInitialize(TestContext testContext)
    {
        if (EAFLoggingUnitTesting is null)
            EAFLoggingUnitTesting = new DEP08SIASM(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__DEP08SIASM__DEP08SIASM()
    {
        string check = "~EDA-IQS";
        MethodBase methodBase = new StackFrame().GetMethod();
        EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
        string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
        Assert.IsTrue(fileNameAndJson[1].Contains(check));
        Assert.IsTrue(fileNameAndJson[1].Contains("DEP08SIASM"));
        File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
        IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
        Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
        EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
    }

    [TestMethod]
    public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM_()
    {
        string check = "~IQS-OpenInsight";
        MethodBase methodBase = new StackFrame().GetMethod();
        EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
        string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
        Assert.IsTrue(fileNameAndJson[1].Contains(check));
        Assert.IsTrue(fileNameAndJson[1].Contains("DEP08SIASM-"));
        File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
        IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
        Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
        EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
    }

    [TestMethod]
    public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM__()
    {
        string check = "~OpenInsight-APC";
        MethodBase methodBase = new StackFrame().GetMethod();
        EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
        string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
        Assert.IsTrue(fileNameAndJson[1].Contains(check));
        Assert.IsTrue(fileNameAndJson[1].Contains("DEP08SIASM--"));
        File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
        IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
        Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
        EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
    }

    [TestMethod]
    public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM___()
    {
        string check = "~APC-SPaCe";
        MethodBase methodBase = new StackFrame().GetMethod();
        EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
        string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
        Assert.IsTrue(fileNameAndJson[1].Contains(check));
        Assert.IsTrue(fileNameAndJson[1].Contains("DEP08SIASM---"));
        File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
        IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
        Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
        EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
    }

    [TestMethod]
    public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM____()
    {
        string check = "~SPaCe-SPaCe Villach";
        MethodBase methodBase = new StackFrame().GetMethod();
        EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
        string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
        Assert.IsTrue(fileNameAndJson[1].Contains(check));
        Assert.IsTrue(fileNameAndJson[1].Contains("DEP08SIASM----"));
        File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
        IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
        Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
        EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
    }

    [TestMethod]
    public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM_____()
    {
        string check = "~SPaCe Villach-Archive";
        MethodBase methodBase = new StackFrame().GetMethod();
        EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
        string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
        Assert.IsTrue(fileNameAndJson[1].Contains(check));
        Assert.IsTrue(fileNameAndJson[1].Contains("DEP08SIASM-----"));
        File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
        IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
        Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
        EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
    }

    [TestMethod]
    public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM______()
    {
        string check = "~Archive";
        MethodBase methodBase = new StackFrame().GetMethod();
        EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
        string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
        Assert.IsTrue(fileNameAndJson[1].Contains(check));
        Assert.IsTrue(fileNameAndJson[1].Contains("DEP08SIASM------"));
        File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
        IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
        Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
        EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
    }

    [TestMethod]
    public void Staging__v2_39_0__DEP08SIASM__DEP08SIASM_______()
    {
        string check = "~IsDummy";
        MethodBase methodBase = new StackFrame().GetMethod();
        EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Getting configuration"));
        string[] fileNameAndJson = EAFLoggingUnitTesting.AdaptationTesting.GetConfiguration(methodBase);
        Assert.IsTrue(fileNameAndJson[1].Contains(check));
        Assert.IsTrue(fileNameAndJson[1].Contains("DEP08SIASM-------"));
        File.WriteAllText(fileNameAndJson[0], fileNameAndJson[1]);
        IFileRead fileRead = EAFLoggingUnitTesting.AdaptationTesting.Get(methodBase, sourceFileLocation: string.Empty, sourceFileFilter: string.Empty, useCyclicalForDescription: false);
        Assert.IsFalse(string.IsNullOrEmpty(fileRead.CellInstanceConnectionName));
        EAFLoggingUnitTesting.Logger.LogInformation(string.Concat(methodBase.Name, " - Exit"));
    }

}