public void Validate()
        {
            var startInfo = CommandLineProgram.Prepare()
                            .WithFileName(@"sqlcmd.exe")
                            .WithArguments(new [] { "-?" });

            try
            {
                CommandLineProgram.Run(startInfo);
            }
            catch (System.ComponentModel.Win32Exception)
            {
                throw new SqlCmdNotFoundException("SQLCMD is not found in your system");
            }
        }
        public void Execute(string scriptFileName)
        {
            var args = GetArgs(scriptFileName);

            var startInfo = CommandLineProgram.Prepare()
                            .WithFileName(@"sqlcmd.exe")
                            .WithArguments(args);

            this.logger.Log("Executing file: {0}", scriptFileName);

            var result = CommandLineProgram.Run(startInfo);

            LogIfHasSomething(result.Error);
            LogIfHasSomething(result.Output);

            if (result.ExitCode != 0)
            {
                throw new InvalidOperationException(
                          string.Format(
                              "Executing {0} finished with the exit code: {1}. Please check log file for more details.",
                              scriptFileName, result.ExitCode));
            }
        }