public Task GetFirstTask(Task.Level difficulty) { foreach (Task t in m_tasks) { if (t.Difficulty == difficulty) return t; } throw new ArgumentOutOfRangeException("difficulty", "No task with difficulty == " + difficulty.ToString()); }
public Task GetNextTask(Task task) { int next = task.Number + 1; if (next >= m_tasks.Count) next = 0; return m_tasks[next]; }
public void TaskTest() { Task t = new Task("1 : B : I A D G : I-E, A-G, E-I"); Assert.IsNotNull(t); Assert.IsTrue(t.Number == 0); Assert.IsTrue(t.Difficulty == Task.Level.Beginner); Assert.IsTrue(t.Name == "1"); Assert.IsTrue(t.Red == 'I'); Assert.IsTrue(t.Greens[0] == 'A' && t.Greens[1] == 'D' && t.Greens[2] == 'G'); Assert.IsTrue(t.Solution.Count == 3); Assert.IsTrue(t.Solution.ElementAt(0).StartPad == 'I' && t.Solution.ElementAt(0).EndPad == 'E'); Assert.IsTrue(t.Solution.ElementAt(1).StartPad == 'A' && t.Solution.ElementAt(1).EndPad == 'G'); Assert.IsTrue(t.Solution.ElementAt(2).StartPad == 'E' && t.Solution.ElementAt(2).EndPad == 'I'); }