public void Init() { tasksResponse = new TasksResponse { Id = 12345, Name = "Das ist ein Testfeld" }; var formGroup = new TaskComponentGroupResponse { Id = 156, Name = "Test 1" }; tasksResponse.FormGroups.Add(formGroup); tasksResponse.Usergroups = new System.Collections.Generic.List<int>(); formGroup.Components.Add(new TextInputResponse { Id = 5555, Name = "Testfeld 1", DefaultValue = "DefaultValue", Order = 1, RegexPattern = "REGEX", Comment = "Kommentar zu 5555", Required = true, Type = ComponentType.TaskComponentText }); }
/// <summary> /// Parsed ein Schnittstellen-Modell in einen Task /// </summary> /// <param name="taskResponse">Das Modell der Schnittstelle.</param> /// <returns>Ein Task-Objekt.</returns> public static Task Parse(TasksResponse taskResponse) { var task = new Task(taskResponse.Id, taskResponse.Name); task.Usergroups = new List<int>(taskResponse.Usergroups); foreach (var item in taskResponse.FormGroups) { if (item == null) continue; task.FormGroups.Add(TaskComponentGroup.Parse(item)); } return task; }