using Json2CSharpCodeGenerator.Lib;
using Json2CSharpCodeGenerator.Lib.CodeWriters;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Json2CSharpCodeGenerator.Tests;

[TestClass]
public class Test_20_ROOT_ARRAY
{
    [TestMethod]
    public void Run()
    {
        string path = Path.Combine(AppContext.BaseDirectory, "Test_20_ROOT_ARRAY_INPUT.txt");
        string resultPath = Path.Combine(AppContext.BaseDirectory, "Test_20_ROOT_ARRAY_OUTPUT.txt");
        string input = File.ReadAllText(path);
        CSharpCodeWriter csharpCodeWriter = new();
        JsonClassGenerator jsonClassGenerator = new()
        {
            CodeWriter = csharpCodeWriter
        };
        string returnVal = jsonClassGenerator.GenerateClasses(input, out _).ToString();
        string resultsCompare = File.ReadAllText(resultPath);
        Assert.AreEqual(resultsCompare.Replace(Environment.NewLine, "").Replace(" ", "").Replace("\t", ""), returnVal.Replace(Environment.NewLine, "").Replace(" ", "").Replace("\t", ""));
    }
}