public void DefaultBehavior_WhenAddingProcess_ProcessShouldBeAdded() { var taskManager = new TaskManagerBuilder(maxCapacity: 1) .With <DefaultBehavior>() .Build(); var process = new Process(1, 2); taskManager.Add(process); taskManager .List().Should().Contain(process); }
public void FIFOBehaviorAndCapacityIsFull_WhenAddingProcess_OldestShouldBeKilled() { var taskManager = new TaskManagerBuilder(maxCapacity: 1) .With <FifoBehavior>() .Build() .WithExistingProcess(); var oldProcess = taskManager.List().Single(); var newProcess = new Process(1, 2); taskManager.Add(newProcess); taskManager .List().Should().Contain(newProcess) .And .NotContain(oldProcess); }
PriorityBehaviorAndCapacityIsFull_WhenAddingProcessWithLeastPriority_OldestShouldBeKeptNewShouldSkipped() { var processWithHigherPriority = new Process(1, 1); var processWithLowerPriority = new Process(2, 5); var taskManager = new TaskManagerBuilder(maxCapacity: 1) .With <PriorityBehavior>() .Build() .WithExistingProcess(processWithHigherPriority); taskManager.Add(processWithLowerPriority); taskManager.List() .Should().Contain(processWithHigherPriority) .And .NotContain(processWithLowerPriority); }