Search in sources :

Example 1 with AddUserRequest

use of com.cmput301w18t05.taskzilla.request.command.AddUserRequest in project Taskzilla by CMPUT301W18T05.

the class BidTest method testSetBid.

/**
 * Test for setting the bid
 */
public void testSetBid() {
    User user = new User();
    Task task = new Task();
    AddUserRequest userRequest = new AddUserRequest(user);
    RequestManager.getInstance().invokeRequest(userRequest);
    userRequest.getResult();
    AddTaskRequest request = new AddTaskRequest(task);
    RequestManager.getInstance().invokeRequest(request);
    request.getResult();
    float bidAmount = 10.00f;
    Bid bid = new Bid(user.getId(), task.getId(), 10.00f);
    assertEquals(bid.getBidAmount(), bidAmount);
}
Also used : AddTaskRequest(com.cmput301w18t05.taskzilla.request.command.AddTaskRequest) AddUserRequest(com.cmput301w18t05.taskzilla.request.command.AddUserRequest)

Example 2 with AddUserRequest

use of com.cmput301w18t05.taskzilla.request.command.AddUserRequest in project Taskzilla by CMPUT301W18T05.

the class RequestManagerTest method addUser.

public void addUser() {
    AddUserRequest addUserRequest = new AddUserRequest(user);
    RequestManager.getInstance().invokeRequest(addUserRequest);
    assertTrue(addUserRequest.getResult());
}
Also used : AddUserRequest(com.cmput301w18t05.taskzilla.request.command.AddUserRequest)

Example 3 with AddUserRequest

use of com.cmput301w18t05.taskzilla.request.command.AddUserRequest in project Taskzilla by CMPUT301W18T05.

the class UserTest method testGetTasksRequested.

// Test for getting a list of tasks that the user has requested
public void testGetTasksRequested() {
    User user = new User();
    user.setUsername("abc");
    AddUserRequest addUserRequest = new AddUserRequest(user);
    RequestManager.getInstance().invokeRequest(getActivity(), addUserRequest);
    Task task1 = new Task("Task name", user, "Task description");
    AddTaskRequest addTaskRequest1 = new AddTaskRequest(task1);
    RequestManager.getInstance().invokeRequest(getActivity(), addTaskRequest1);
    Task task2 = new Task("Task name", user, "Task description");
    AddTaskRequest addTaskRequest2 = new AddTaskRequest(task2);
    RequestManager.getInstance().invokeRequest(getActivity(), addTaskRequest2);
    ArrayList<Task> tasks = new ArrayList<>();
    tasks.add(task1);
    tasks.add(task2);
    ArrayList<Task> result = new ArrayList<>();
    result = user.getTasksRequested();
    assertTrue(tasks.containsAll(result) && result.containsAll(tasks));
}
Also used : ArrayList(java.util.ArrayList) AddTaskRequest(com.cmput301w18t05.taskzilla.request.command.AddTaskRequest) AddUserRequest(com.cmput301w18t05.taskzilla.request.command.AddUserRequest)

Example 4 with AddUserRequest

use of com.cmput301w18t05.taskzilla.request.command.AddUserRequest in project Taskzilla by CMPUT301W18T05.

the class ProfileController method updateUserRequest.

/**
 * getUserRequest
 * get user from RequestManager and set the
 * user to be the result for the controller
 *
 * @author Micheal-Nguyen
 */
public void updateUserRequest(User user) {
    AddUserRequest request = new AddUserRequest(user);
    RequestManager.getInstance().invokeRequest(ctx, request);
}
Also used : AddUserRequest(com.cmput301w18t05.taskzilla.request.command.AddUserRequest)

Example 5 with AddUserRequest

use of com.cmput301w18t05.taskzilla.request.command.AddUserRequest in project Taskzilla by CMPUT301W18T05.

the class RequestManagerTest method testAddUserRequest.

public void testAddUserRequest() {
    AddUserRequest addUserRequest = new AddUserRequest(user);
    RequestManager.getInstance().invokeRequest(ctx, addUserRequest);
    assertTrue(addUserRequest.getResult());
}
Also used : AddUserRequest(com.cmput301w18t05.taskzilla.request.command.AddUserRequest)

Aggregations

AddUserRequest (com.cmput301w18t05.taskzilla.request.command.AddUserRequest)9 AddTaskRequest (com.cmput301w18t05.taskzilla.request.command.AddTaskRequest)3 EmailAddress (com.cmput301w18t05.taskzilla.EmailAddress)1 PhoneNumber (com.cmput301w18t05.taskzilla.PhoneNumber)1 Photo (com.cmput301w18t05.taskzilla.Photo)1 Review (com.cmput301w18t05.taskzilla.Review)1 RequestManager (com.cmput301w18t05.taskzilla.request.RequestManager)1 ArrayList (java.util.ArrayList)1