Exemple #1
0
        public JsonResult CancelJob(Int32 jobId)
        {
            IList <EnclosingJob> enclosedJobs = this.enclosingJobService.GetEnclosingJobsByJobId(jobId);
            Boolean docketNumberMissing       = enclosedJobs.Any(enclosingJob => String.IsNullOrWhiteSpace(enclosingJob.PostalDocketNumber));

            if (!docketNumberMissing)
            {
                throw new InvalidOperationException("Cannot cancel job as all docket numbers are present");
            }

            JobStatusTypeEntity jobStatusType = this.jobStatusTypeService.GetJobStatusType(JobStatusTypes.Cancelled);

            this.jobService.UpdateJobStatus(jobId, jobStatusType.JobStatusTypeID);
            return(this.Json(new { Status = JobStatusTypes.Cancelled }));
        }
Exemple #2
0
 public void SetUp()
 {
     this.authoriseHistoryService = new Mock <IAuthoriseHistoryService>();
     this.jobService = new Mock <IJobService>();
     this.jobStatusTypeRepository = new Mock <IJobStatusTypeRepository>();
     this.authoriseJobEngine      = new AuthoriseJobEngine(
         this.authoriseHistoryService.Object,
         this.jobService.Object,
         this.jobStatusTypeRepository.Object);
     this.jobIds = new List <Int32>();
     this.jobIds.Add(2);
     this.jobIds.Add(7);
     this.jobIds.Add(9);
     this.jobIds.Add(5);
     this.jobStatusTypeEntity = new JobStatusTypeEntity()
     {
         JobStatusDescription = "description", JobStatusTypeID = 2
     };
 }
Exemple #3
0
        public void SetUp()
        {
            this.jobRepository           = new Mock <IJobRepository>();
            this.manCoDocRepository      = new Mock <IManCoDocRepository>();
            this.environmentTypeService  = new Mock <IEnvironmentTypeService>();
            this.filePathBuilderEngine   = new Mock <IFilePathBuilderEngine>();
            this.inputFileRepository     = new Mock <IInputFileRepository>();
            this.submitJobFileRepository = new Mock <ISubmitJobFileRepository>();
            this.jobStatusTypeRepository = new Mock <IJobStatusTypeRepository>();
            this.createJobEngine         = new CreateJobEngine(
                this.jobRepository.Object,
                this.manCoDocRepository.Object,
                this.environmentTypeService.Object,
                this.filePathBuilderEngine.Object,
                this.inputFileRepository.Object,
                this.submitJobFileRepository.Object,
                this.jobStatusTypeRepository.Object);

            this.files = new List <String>()
            {
                "file1", "file2"
            };
            this.jobStatusTypeEntity = new JobStatusTypeEntity()
            {
                JobStatusDescription = "description", JobStatusTypeID = 2
            };

            this.environmentTypeService.Setup(e => e.GetEnvironmentServers(It.IsAny <String>())).Returns(new List <EnvironmentServerEntity>()
            {
                new EnvironmentServerEntity()
            });
            this.inputFileRepository.Setup(i => i.GetInputFile(It.IsAny <String>(), It.IsAny <String>())).Returns(new List <InputFile>());
            this.filePathBuilderEngine.Setup(f => f.BuildInputFileLocationPath(It.IsAny <String>(), It.IsAny <String>(), It.IsAny <String>())).Returns("path");
            this.manCoDocRepository.Setup(m => m.GetManCoDoc(It.IsAny <String>(), It.IsAny <String>(), It.IsAny <String>(), It.IsAny <String>())).Returns(new ManCoDoc());
            this.jobRepository.Setup(i => i.InsertJob(It.IsAny <Int32>(), It.IsAny <String>(), It.IsAny <String>(), It.IsAny <String>(), It.IsAny <Int32>())).Returns(1);
            this.filePathBuilderEngine.Setup(b => b.BuildOneStepMonitorPath(It.IsAny <String>())).Returns("path2");
            this.inputFileRepository.Setup(c => c.InsertFile(It.IsAny <String>(), It.IsAny <String>(), It.IsAny <Int32>(), It.IsAny <Int32>()));
            this.submitJobFileRepository.Setup(s => s.SaveTriggerFile(It.IsAny <Int32>(), It.IsAny <SubmitFile>(), It.IsAny <String>()));
            this.jobStatusTypeRepository.Setup(x => x.GetJobStatusType(It.IsAny <String>())).Returns(this.jobStatusTypeEntity);
        }