public void MethodCallsFromAnEmptyConstructor() { WlbScheduledTasks tasks = new WlbScheduledTasks(); Assert.AreEqual(0, tasks.TaskList.Count, "TaskList"); Assert.AreEqual(0, tasks.SortedTaskList.Count, "SortedTaskList"); Assert.AreEqual(0, tasks.VirtualTaskList.Count, "VirtualTaskList"); Assert.IsNull(tasks.ToDictionary(), "Conversion to dictionary"); Assert.IsNull(tasks.GetNextExecutingTask(), "GetNextExecutingTask"); }
public void MethodCallsFromADictionaryConstructedObject() { WlbScheduledTasks tasks = new WlbScheduledTasks(new Dictionary<string, string>() { {"schedTask_dosomething", "now"}, {"schedTask_3", "later"}, {"schedTask_1", "sooner"}, {"domoresomethings", "will not be added"} }); //Task List Construction Assert.AreEqual(3, tasks.TaskList.Count ); Assert.AreEqual(0, tasks.TaskList["dosomething"].TaskId); Assert.AreEqual(1, tasks.TaskList["1"].TaskId); Assert.AreEqual(3, tasks.TaskList["3"].TaskId); //Dictionary Conversion Assert.AreEqual(3, tasks.ToDictionary().Count, "Conversion to dictionary"); //Sorted Tasks SortedDictionary<int, WlbScheduledTask> sortedTasks = tasks.SortedTaskList; Assert.AreEqual(3, sortedTasks.Count, "SortedTaskList"); List<WlbScheduledTask> tasksValues = new List<WlbScheduledTask>(sortedTasks.Values); Assert.AreEqual(0, tasksValues[0].TaskId); Assert.AreEqual(3, tasksValues[1].TaskId); Assert.AreEqual(1, tasksValues[2].TaskId); //Virtual Tasks Assert.AreEqual(0, tasks.VirtualTaskList.Count, "VirtualTaskList"); //Next task WlbScheduledTask nextTask = tasks.GetNextExecutingTask(); Assert.IsNull( nextTask, "GetNextExecutingTask"); }