Ejemplo n.º 1
0
 public ScreenManager(Game game)
     : base(game)
 {
     screens = new List <BaseScreen>();
     Jobs    = new BackgroundJobs();
     Jobs.SpinUp();
 }
Ejemplo n.º 2
0
        public ActionResult QueueServerBJob2(Default1Model model)
        {
            var jobClient = new BackgroundJobClient();
            var jobId     = jobClient.Enqueue(() => BackgroundJobs.QueueServerBJob2());

            model.ServerBJob2Id = jobId;
            return(View("Index", model));
        }
        private void TestDataSetUp()
        {
            BackgroundJobs bgJob = new BackgroundJobs {
                JobID = 1, JobDuration = 10, JobTimeStramp = DateTime.Now, Status = JobConstants.Status_Inprogress
            };
            List <BackgroundJobs> backgroundJobsList = new List <BackgroundJobs>();

            backgroundJobsList.Add(bgJob);
        }
Ejemplo n.º 4
0
        public async Task GetById_Test()
        {
            BackgroundJobs bgJob = new BackgroundJobs {
                JobID = 1, JobDuration = 10, JobTimeStramp = DateTime.Now, Status = JobConstants.Status_Inprogress
            };
            List <BackgroundJobs> backgroundJobsList = new List <BackgroundJobs>();

            backgroundJobsList.Add(bgJob);
            _mockbghsDbContext.Setup(a => a.GetCurrentBackgroundJobs()).ReturnsAsync(backgroundJobsList);
            var res = (await backgroundJobController.GetById(1)) as OkObjectResult;

            Assert.Equal(bgJob, res.Value);
        }
Ejemplo n.º 5
0
        public async Task GetById_NegativeTest()
        {
            BackgroundJobs bgJob = new BackgroundJobs {
                JobID = 1, JobDuration = 10, JobTimeStramp = DateTime.Now, Status = JobConstants.Status_Inprogress
            };
            List <BackgroundJobs> backgroundJobsList = new List <BackgroundJobs>();

            backgroundJobsList.Add(bgJob);
            _mockbghsDbContext.Setup(a => a.GetCurrentBackgroundJobs()).Throws(new Exception("Internal Server Exception!!"));
            try
            {
                var res = await backgroundJobController.GetById(1);
            }
            catch (Exception ex) {
                Assert.NotNull(ex);
            }
        }
Ejemplo n.º 6
0
        public async Task ExecuteSortArray(int[] inputArr)
        {
            _iLogger.LogInformation("New Array is added for sorting!!", inputArr);
            using (var scope = serviceScopeFactory.CreateScope())
            {
                BackgroundJobs backgroundJob = new BackgroundJobs();
                var            dbContext     = scope.ServiceProvider.GetService <BGHSDbContext>();
                Stopwatch      stopWatch     = new Stopwatch();
                stopWatch.Start();
                //sort the array from backgroundJob reference
                GetArraySorted(inputArr);

                stopWatch.Stop();
                long duration = stopWatch.ElapsedMilliseconds;
                backgroundJob.JobDuration = duration;
                backgroundJob.Status      = JobConstants.Status_Completed;
                dbContext.BackgroundJobData.Add(backgroundJob);
                await dbContext.SaveChangesAsync();

                _iLogger.LogInformation("Added Array Sorting id completed", backgroundJob);
            }
        }