package guitests;

import guitests.guihandles.TaskCardHandle;
import org.junit.Test;

import seedu.taskitty.commons.core.Messages;
import seedu.taskitty.logic.commands.AddCommand;
import seedu.taskitty.testutil.TestTask;
import seedu.taskitty.testutil.TestUtil;

import static org.junit.Assert.assertTrue;

public class AddCommandTest extends TaskManagerGuiTest {
/*
    @Test
    public void add() {
        //add one task
        TestTask[] currentList = td.getTypicalTasks();
        TestTask taskToAdd = td.todo;
        assertAddSuccess(taskToAdd, currentList);
        currentList = TestUtil.addPersonsToList(currentList, taskToAdd);

        //add another task
        taskToAdd = td.deadline;
        assertAddSuccess(taskToAdd, currentList);
        currentList = TestUtil.addPersonsToList(currentList, taskToAdd);

        //add duplicate task
        commandBox.runCommand(td.deadline.getAddCommand());
        assertResultMessage(AddCommand.MESSAGE_DUPLICATE_TASK);
        assertTrue(taskListPanel.isListMatching(currentList));

        //add to empty list
        commandBox.runCommand("clear");
        assertAddSuccess(td.deadline);

        //invalid command
        commandBox.runCommand("adds party");
        assertResultMessage(Messages.MESSAGE_UNKNOWN_COMMAND);
    }

    private void assertAddSuccess(TestTask personToAdd, TestTask... currentList) {
        commandBox.runCommand(personToAdd.getAddCommand());

        //confirm the new card contains the right data
        TaskCardHandle addedCard = taskListPanel.navigateToPerson(personToAdd.getName().fullName);
        assertMatching(personToAdd, addedCard);

        //confirm the list now contains all previous persons plus the new person
        TestTask[] expectedList = TestUtil.addPersonsToList(currentList, personToAdd);
        assertTrue(taskListPanel.isListMatching(expectedList));
    }*/

}

@@ -214,16 +214,61 @@
 stTask;%0A
+import seedu.taskitty.testutil.TestTaskList;%0A
 import s
@@ -406,10 +406,8 @@
 t %7B%0A
-/*
 %0A   
@@ -476,18 +476,20 @@
 TestTask
-%5B%5D
+List
  current
@@ -495,16 +495,33 @@
 tList = 
+new TestTaskList(
 td.getTy
@@ -532,16 +532,17 @@
 lTasks()
+)
 ;%0A      
@@ -613,92 +613,41 @@
 dd, 
-currentList);%0A        currentList = TestUtil.addPersonsToList(currentList, taskToAdd
+td.todo.getNumArgs(), currentList
 );%0A%0A
@@ -746,92 +746,45 @@
 dd, 
-currentList);%0A        currentList = TestUtil.addPersonsToList(currentList, taskToAdd
+td.deadline.getNumArgs(), currentList
 );%0A%0A
@@ -951,37 +951,35 @@
  assertTrue(
-taskListPanel
+currentList
 .isListMatch
@@ -982,27 +982,29 @@
 atching(
-currentList
+taskListPanel
 ));%0A%0A   
@@ -1080,36 +1080,104 @@
     
-assertAddSuccess(td.deadline
+currentList.clear();%0A        assertAddSuccess(td.deadline, td.deadline.getNumArgs(), currentList
 );%0A%0A
@@ -1360,28 +1360,36 @@
 estTask 
-person
+task
 ToAdd,
+ int type,
  TestTas
@@ -1393,11 +1393,12 @@
 Task
-...
+List
  cur
@@ -1439,22 +1439,20 @@
 Command(
-person
+task
 ToAdd.ge
@@ -1586,21 +1586,17 @@
 teTo
-Person(person
+Task(task
 ToAd
@@ -1615,16 +1615,22 @@
 fullName
+, type
 );%0A     
@@ -1647,22 +1647,20 @@
 atching(
-person
+task
 ToAdd, a
@@ -1764,79 +1764,38 @@
     
-TestTask%5B%5D expectedList = TestUtil.addPersonsToList(currentList, person
+currentList.addTaskToList(task
 ToAd
@@ -1817,29 +1817,27 @@
 ertTrue(
-taskListPanel
+currentList
 .isListM
@@ -1848,20 +1848,21 @@
 ing(
-expectedList
+taskListPanel
 ));%0A
@@ -1870,10 +1870,8 @@
    %7D
-*/
 %0A%0A%7D%0A

Fix tests for add command