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);
}
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());
}
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));
}
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);
}
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());
}
Aggregations