public void OnlyScheduleableUsingNONPreemption()
        {
            var taskSet = new List <Task>
            {
                new Task {
                    ExecutionTime = 20, Period = 70, Deadline = 55, StaticPriority = 3, Id = "A"
                },
                new Task {
                    ExecutionTime = 20, Period = 80, Deadline = 80, StaticPriority = 2, Id = "B"
                },
                new Task {
                    ExecutionTime = 35, Period = 200, Deadline = 100, StaticPriority = 1, Id = "C"
                },
            };


            //preemptive scheduling - reset dynamic priorities
            taskSet.ForEach(o => o.DynamicPriority = o.StaticPriority);
            var scheduleableUsingPreemption = ResponseTimeAnalysis.FeasibilityUsingResponseTimeAnalysis(taskSet);

            Assert.False(scheduleableUsingPreemption);

            //non-preemptive scheduling
            taskSet.ForEach(o => o.DynamicPriority = taskSet.Max(x => x.StaticPriority));

            var scheduleableUsingNonPreemption = ResponseTimeAnalysis.FeasibilityUsingResponseTimeAnalysis(taskSet);

            Assert.True(scheduleableUsingNonPreemption);


            var resultFile = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "nonpreempt.txt");

            TaskFileReader.CreateTaskFile(taskSet, resultFile);
        }
        public void TaskFileReader1()
        {
            var fileName        = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Task1Import.txt");
            var resultReadInDto = TaskFileReader.ReadInTasksFromFile(fileName);
            var taskSet         = resultReadInDto.tasks;

            Assert.Equal(taskSet.Count, 3);
            Assert.Equal(taskSet[0].ExecutionTime, 20);
            Assert.Equal(taskSet[0].Period, 70);
            Assert.Equal(taskSet[0].Deadline, 50);
            Assert.Equal(taskSet[0].StaticPriority, 3);
            Assert.Equal(taskSet[0].DynamicPriority, 3);


            Assert.Equal(taskSet[1].ExecutionTime, 20);
            Assert.Equal(taskSet[1].Period, 80);
            Assert.Equal(taskSet[1].Deadline, 80);
            Assert.Equal(taskSet[1].StaticPriority, 2);
            Assert.Equal(taskSet[1].DynamicPriority, 3);

            Assert.Equal(taskSet[2].ExecutionTime, 35);
            Assert.Equal(taskSet[2].Period, 200);
            Assert.Equal(taskSet[2].Deadline, 100);
            Assert.Equal(taskSet[2].StaticPriority, 1);
            Assert.Equal(taskSet[2].DynamicPriority, 2);


            var isScheduable = ResponseTimeAnalysis.FeasibilityUsingResponseTimeAnalysis(taskSet);
            var exist        = ResponseTimeAnalysis.DoesFeasibleScheduleExist(taskSet);

            Assert.Equal(isScheduable, exist);
            Assert.True(isScheduable);
        }
        public void PreemptionDeadline()
        {
            var fileName        = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Task2Import.txt");
            var resultReadInDto = TaskFileReader.ReadInTasksFromFile(fileName);
            var taskSet         = resultReadInDto.tasks;

            ResponseTimeAnalysis.ChangeDynamicPrioritiesToMeetDeadlines(taskSet);
            var isScheduleable = ResponseTimeAnalysis.FeasibilityUsingResponseTimeAnalysis(taskSet);
            var exist          = ResponseTimeAnalysis.DoesFeasibleScheduleExist(taskSet);

            Assert.Equal(isScheduleable, exist);
            Assert.True(isScheduleable);
        }