public void QuoteFirstArg(params string[] args)
        {
            var configBuilder = new ConfigurationBuilder();

            WorkerHostBuilderExtensions.RegisterCommandLine(configBuilder, args);

            var config = configBuilder.Build();

            Assert.Equal("127.0.0.1", config["host"]);
        }
        public void RegisterCommandLine_NoArgs(int count)
        {
            var args = Enumerable.Repeat <string>("test", count).ToArray();

            var configBuilder = new ConfigurationBuilder();

            WorkerHostBuilderExtensions.RegisterCommandLine(configBuilder, args);

            // Ensures we don't throw an IndexOutOfRangeException; no assert necessary.
            configBuilder.Build();
        }
        public void QuoteFirstArg(string firstArg, string expected)
        {
            var cmdLineList = new List <string> {
                "--host", "127.0.0.1"
            };

            if (firstArg != null)
            {
                cmdLineList.Insert(0, firstArg);
            }

            var cmdLine = cmdLineList.ToArray();

            var configBuilder = new ConfigurationBuilder();

            WorkerHostBuilderExtensions.RegisterCommandLine(configBuilder, cmdLine);

            Assert.Equal(expected, cmdLine[0]);

            var config = configBuilder.Build();

            Assert.Equal("127.0.0.1", config["host"]);
        }