public CodeGenerationConsoleManagerTests(ITestOutputHelper outputHelper)
            : base(outputHelper)
        {
            OutputDirectory = $"{Guid.NewGuid():D}";

            // First is the OutputWriter, second is the ErrorWriter.
            StringBuilders = GetRange(new StringBuilder(), new StringBuilder()).ToArray();
            StringWriters  = StringBuilders.Select(sb => new StringWriter(sb)).ToArray();

            //was using: new TestOutputHelperTextWriter(OutputHelper)
            Manager = new CodeGenerationConsoleManager(StringWriters[0], StringWriters[1]);
        }
        private void VerifySingleCodeGenerationPass(out CodeGenerationConsoleManager manager
                                                    , out OrToolsSatGeneratedSyntaxTreeRegistry registry)
        {
            // TODO: TBD: for a single pass, it might make sense to refactor this block of code... rinse and repeat for other scenarios...
            VerifyManager((m, a) => ConfigureDefaultArguments(a), DefaultErrorLevel, out manager, out registry);

            var local = registry;

            Path.Combine(registry.OutputDirectory, RegistryFileName).AssertFileExists();

            void VerifyGeneratedFileExists(Guid key) => Path.Combine(local.OutputDirectory, key.RenderGeneratedFileName()).AssertFileExists();

            registry.AssertNotNull().AssertNotEmpty().SelectMany(x => x.GeneratedAssetKeys)
            .ToList().ForEach(VerifyGeneratedFileExists);
        }
        internal void VerifyManager(ConfigureManagerCallback configure, int expectedErrorLevel
                                    , out CodeGenerationConsoleManager manager, out OrToolsSatGeneratedSyntaxTreeRegistry registry)
        {
            manager = Manager.AssertNotNull();

            configure.AssertNotNull().Invoke(manager, Arguments);

            manager.TryParseOrShowHelp(Arguments.ToArray()).AssertTrue();

            manager.Run(out var actualErrorLevel);

            // Whatever the outcome was, obtain that Registry.
            registry = manager.Registry;

            actualErrorLevel.AssertEqual(expectedErrorLevel);

            // ReSharper disable once SwitchStatementMissingSomeCases
            switch (expectedErrorLevel)
            {
            case DefaultErrorLevel:
                registry.AssertNotNull().AssertNotEmpty();
                break;

            case ErrorGeneratingCode:
                // TODO: TBD: may elaborate on what this means, 'error' ...
                break;

            case MustSpecifyOutputDirectory:
                manager.OutputDirectoryVar.Value.AssertTrue(IsNullOrEmpty);
                registry.AssertNull();
                break;

            case MustSpecifyRegistryFileName:
                manager.OutputDirectoryVar.Value.AssertNotNull().AssertNotEmpty();
                manager.GeneratedCodeRegistryFileVar.Value.AssertTrue(IsNullOrEmpty);
                registry.AssertNull();
                break;
            }
        }