public HubProxyIntegrationTests()
        {
            reporter   = new InvocationReporter();
            factory    = new ApplicationFactory <SimpleHub>(services => services.AddSingleton(reporter));
            connection = new HubConnectionBuilder()
                         .WithUrl(new Uri("http://localhost/hub"), opts => opts.HttpMessageHandlerFactory = _ => factory.Server.CreateHandler())
                         .Build();

            hubContext = factory.Services.GetRequiredService <IHubContext <SimpleHub, IHubEvents> >();
            proxy      = SignalRProxyGenerator.CreateProxy <IHubContract>(connection);
        }
        public void GenerateSample()
        {
            var signalRProxyGenerator = new SignalRProxyGenerator();
            var signalRUrlPath        = "/signalr";
            var metaData = new[]
            {
                "// Some metadata I want",
            };
            var javaScript = signalRProxyGenerator.Generate(signalRUrlPath, metaData);

            Console.WriteLine(javaScript);
        }
        private static void Run(CommandLineOptions commandLineOptions)
        {
            LoadAssemblies(commandLineOptions);

            string url = null;

            string[] metadata = null;
            string   outputText;

            if (!string.IsNullOrWhiteSpace(commandLineOptions.Url))
            {
                url = commandLineOptions.Url;
            }

            if (!string.IsNullOrWhiteSpace(commandLineOptions.Metadata))
            {
                metadata = commandLineOptions.Metadata.Split(',');
            }

            var hubJavaScriptGenerator = new SignalRProxyGenerator();

            if (url != null && metadata != null)
            {
                outputText = hubJavaScriptGenerator.Generate(signalRUrlPath: url, metaData: metadata);
            }
            else if (url == null && metadata != null)
            {
                outputText = hubJavaScriptGenerator.Generate(metaData: metadata);
            }
            else if (url != null && metadata == null)
            {
                outputText = hubJavaScriptGenerator.Generate(signalRUrlPath: url);
            }
            else
            {
                outputText = hubJavaScriptGenerator.Generate();
            }


            if (string.IsNullOrWhiteSpace(commandLineOptions.OutFile))
            {
                System.Console.WriteLine(outputText);
            }
            else
            {
                File.WriteAllText(commandLineOptions.OutFile, outputText);
            }
        }