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"); }
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 WlbPoolConfiguration(Dictionary <string, string> configuration) { if (null != configuration) { base.Configuration = configuration; PopulateKeyValues(); _hostConfigurations = new WlbHostConfigurations(base.Configuration); _scheduledTasks = new WlbScheduledTasks(base.Configuration); } else { throw new Exception("WLBPoolConfiguration is null"); } }
public WlbPoolConfiguration(Dictionary<string, string> configuration) { if (null != configuration) { base.Configuration = configuration; PopulateKeyValues(); _hostConfigurations = new WlbHostConfigurations(base.Configuration); _scheduledTasks = new WlbScheduledTasks(base.Configuration); } else { throw new Exception("WLBPoolConfiguration is null"); } }
public void EmptyConstructorCausesLastTaskToThrow() { WlbScheduledTasks tasks = new WlbScheduledTasks(); tasks.GetLastExecutingTask(); }
public void EmptyConstructorCausesCurrentScheduledPerformanceModeToThrow() { WlbScheduledTasks tasks = new WlbScheduledTasks(); tasks.GetCurrentScheduledPerformanceMode(); }
private WlbScheduledTasks BuildSampleTasksWithTimes() { WlbScheduledTasks tasks = new WlbScheduledTasks(); Dictionary<string, string > taskParameters = new Dictionary<string, string>() { { "OptMode", "1"} // Performance mode }; WlbScheduledTask taskA = new WlbScheduledTask("1") { DaysOfWeek = WlbScheduledTask.WlbTaskDaysOfWeek.Friday, TaskParameters = taskParameters }; WlbScheduledTask taskB = new WlbScheduledTask("2") { DaysOfWeek = WlbScheduledTask.WlbTaskDaysOfWeek.Monday, TaskParameters = taskParameters }; //Weekend tasks adds 2 to the virtual task list, one for each day WlbScheduledTask taskC = new WlbScheduledTask("3") { DaysOfWeek = WlbScheduledTask.WlbTaskDaysOfWeek.Weekends, TaskParameters = taskParameters }; Dictionary<string, WlbScheduledTask> taskCollection = new Dictionary<string, WlbScheduledTask>() { {"schedTask_1", taskA}, {"schedTask_2", taskB}, {"schedTask_3", taskC} }; Assert.AreEqual(3, taskCollection.Count, "Setting up task collection"); tasks.TaskList = taskCollection; return tasks; }