public void executeAll()
        {
            Owner ow = new Owner("Nicolai");
            Scheduler sh = new Scheduler();

            for(int i = 0; i < 30; i++)
            {
                sh.addJob(new Job(1, 200+i, ow, s => "Hello world"));
            }

            for(int i = 0; i < 30; i++)
            {
                sh.addJob(new Job(1, 600+i, ow, s => "Hello world"));
            }

            for (int i = 0; i < 30; i++)
            {
                sh.addJob(new Job(1, 2001 + i, ow, s => "Hello world"));
            }

            sh.executeAll();

            // Sleeps for a second to make sure that all Jobs gets done
            System.Threading.Thread.Sleep(3000);

            Assert.AreEqual(0, sh.JobQueue.Count);

            Assert.AreEqual(0, sh.shortRunningJobs);
            Assert.AreEqual(0, sh.longRunningJobs);
            Assert.AreEqual(0, sh.veryLongRunningJobs);
        }
        public void findJob_findFirst()
        {
            Scheduler sch = new Scheduler();
            Job j1 = new Job(1, 300, new Owner("nicolai"), s => "Hello " + s);
            Job j2 = new Job(1, 700, new Owner("nicolai"), s => "Hello " + s);
            Job j3 = new Job(1, 3000, new Owner("nicolai"), s => "Hello " + s);

            sch.addJob(j1);
            sch.addJob(j2);
            sch.addJob(j3);

            Job nextJob = sch.findNextJobToRun();
            Assert.AreEqual(j1, nextJob);
        }
        public void popJob_popVeryLongJob()
        {
            Owner ow = new Owner("Nicolai");
            Job j1 = new Job(1, 30000, ow, s => "Hello world");
            Job j2 = new Job(1, 30002, ow, s => "Hello world");
            Job j3 = new Job(1, 3000000, ow, s => "Hello world");

            Scheduler sh = new Scheduler();

            sh.addJob(j3);
            sh.addJob(j1);
            sh.addJob(j2);

            Assert.AreEqual(j3, sh.PopJob());
        }
        public void findJob_notEnoughCPU_delayFirstOnce()
        {
            Scheduler sch = new Scheduler();
            BenchmarkSystem.BenchmarkSystem.AvailableCPU = 2;
            Job j1 = new Job(3, 300, new Owner("nicolai"), s => "Hello " + s);
            Job j2 = new Job(1, 700, new Owner("nicolai"), s => "Hello " + s);
            Job j3 = new Job(1, 3000, new Owner("nicolai"), s => "Hello " + s);

            sch.addJob(j1);
            sch.addJob(j2);
            sch.addJob(j3);

            Job nextJob = sch.findNextJobToRun();

            Assert.AreEqual(j2, nextJob);
        }
        public void addJob()
        {
            Owner ow = new Owner("Nicolai");
            Job job = new Job(1, 30000, ow, s => "Hello world");
            Scheduler sh = new Scheduler();

            sh.addJob(job);

            Assert.AreEqual(1, sh.JobQueue.Count);
        }
        public void findJob_toManyShortAndLongJobs()
        {
            Scheduler sch = new Scheduler();
            Job j1 = new Job(1, 300, new Owner("nicolai"), s => "Hello " + s);
            Job j2 = new Job(1, 700, new Owner("nicolai"), s => "Hello " + s);
            Job j3 = new Job(1, 3000, new Owner("nicolai"), s => "Hello " + s);

            sch.addJob(j1);
            sch.addJob(j2);
            sch.addJob(j3);

            sch.shortRunningJobs = sch.longRunningJobs = 40;
            Job nextJob = sch.findNextJobToRun();

            Assert.AreEqual(j3, nextJob);
        }