Batman.Core.Tasks.TaskManager.Run C# (CSharp) Method

Run() public method

Runs the tasks associated with the run time specified
public Run ( RunTime TimeToRun ) : void
TimeToRun RunTime Time to run
return void
        public void Run(RunTime TimeToRun)
        {
            if (Tasks.ContainsKey(TimeToRun))
            {
                Tasks[TimeToRun].ForEach(x =>
                {
                    if (BatComputer.Bootstrapper != null)
                        BatComputer.Bootstrapper.Resolve<LogBase>(new NullLogger()).LogMessage("Running {0}", MessageType.Info, x.Name);
                    x.Run();
                });
            }
        }

Usage Example

Example #1
0
 public void BasicTest()
 {
     TaskManager Manager = new TaskManager();
     Manager.Run(RunTime.PreStart);
     Assert.Equal(1, Manager.Tasks.Count);
 }