public TestOutcome CreateHierarchicalTask() { TestOutcome outcome = new TestOutcome(); outcome.moduleName = "Task"; outcome.methodName = "TaskCreate(Hierarchical)"; try { TasksApi tasksApi = new TasksApi(_url); IO.Swagger.Model.Task task = TaskGenerator.GetHierarchicalTask(); JobReport job = tasksApi.TaskCreate(_session.SessionId, "all", task); JobReport polledJob = JobHandler.pollJob(job, _session.SessionId, _url); if (polledJob.ErrorMessage != null) { outcome.outcome = polledJob.ErrorMessage; } else { outcome.outcome = "Success"; } return(outcome); } catch (Exception ex) { outcome.outcome = ex.Message; return(outcome); } }
public TestOutcome DestroyTask(string filterstring) { TestOutcome outcome = new TestOutcome(); outcome.moduleName = "Task"; outcome.methodName = "TaskDestroy"; try { TasksApi tasksApi = new TasksApi(_url); IO.Swagger.Model.Task task = TaskGenerator.GetFlatTask(); JobReport job = tasksApi.TaskCreate(_session.SessionId, "all", task); JobReport polledJob = JobHandler.pollJob(job, _session.SessionId, _url); FolderArray tasks = tasksApi.TaskSearch(_session.SessionId, "", true, 100, FilterGenerator.SimpleFilter("tasks.name", "like", filterstring + "%")); tasksApi.TaskDestroy(_session.SessionId, tasks[0].ReferenceId); outcome.outcome = "Success"; return(outcome); } catch (Exception ex) { outcome.outcome = ex.Message; return(outcome); } }