protected void FinializeTest(int playerIndex, TaskInfo task, TaskEngineEvent <TaskInfo> callback, TaskEngineEvent <TaskInfo> childTaskCallback = null) { long identity = 0; TaskEngine.GenerateIdentitifers(task, ref identity); TaskEngineEvent <TaskInfo> taskStateChangedEventHandler = null; taskStateChangedEventHandler = taskInfo => { if (taskInfo.TaskId == task.TaskId) { if (taskInfo.State != TaskState.Active) { m_engine.GetTaskEngine(playerIndex).TaskStateChanged -= taskStateChangedEventHandler; callback(taskInfo); } } else { if (childTaskCallback != null) { childTaskCallback(taskInfo); } } }; m_engine.GetTaskEngine(playerIndex).TaskStateChanged += taskStateChangedEventHandler; m_engine.Submit(playerIndex, new TaskCmd(SerializedTask.FromTaskInfo(task))); RunEngine(); Assert.Fail(); }