public JobInfo BuildJob(JobSubmitParameters parameters)
        {
            FixupSubmitParameters(parameters);
            var job_info = this.RestClients._JobRest.JobBuild(this.Account, parameters);

            return(job_info);
        }
        public JobInfo JobBuild(AnalyticsAccountRef account, JobSubmitParameters parameters)
        {
            var job_props = parameters.ToJobInformationObject();
            var job_info  = this.RestClient.Job.Build(account.Name, job_props);
            var j         = new JobInfo(job_info, account);

            return(j);
        }
        public void Submit_Job_with_Syntax_Error()
        {
            this.Initialize();
            var submit_parameters = new JobSubmitParameters();

            submit_parameters.ScriptText = "FOOBAR";
            submit_parameters.JobName    = "Test Job";
            var ji = this.AnalyticsClient.Jobs.SubmitJob(submit_parameters);

            System.Console.WriteLine("{0} {1} {2}", ji.Name, ji.JobId, ji.SubmitTime);

            var ji2 = this.AnalyticsClient.Jobs.GetJobDetails(ji.JobId, false);

            Assert.AreEqual(ji.Name, ji2.JobInfo.Name);
        }
        private static void FixupSubmitParameters(JobSubmitParameters parameters)
        {
            // If caller doesn't provide a guid, then create a new one
            if (parameters.JobId == default(System.Guid))
            {
                parameters.JobId = System.Guid.NewGuid();
            }

            // if caller doesn't provide a name, then create one automativally
            if (parameters.JobName == null)
            {
                // TODO: Handle the date part of the name nicely
                parameters.JobName = "USQL " + System.DateTimeOffset.Now.ToString();
            }
        }