public function testGetsAllGroups()
 {
     $groupId = 123232;
     $groupItemView = new GroupItemView($groupId, 'name');
     $groupItemView->Id = $groupId;
     $list = array($groupItemView);
     $groups = new PageableData($list);
     $this->groupViewRepository->expects($this->once())->method('GetList')->with($this->isNull(), $this->isNull())->will($this->returnValue($groups));
     $this->service->GetGroups();
     $expectedResponse = new GroupsResponse($this->server, $list);
     $this->assertEquals($expectedResponse, $this->server->_LastResponse);
 }
 public function testWhenInitializing()
 {
     $groups = array();
     $bookableResources = array();
     $schedules = array();
     $groupResult = new PageableData($groups);
     $quotaList = array();
     $this->resourceRepository->expects($this->once())->method('GetResourceList')->will($this->returnValue($bookableResources));
     $this->page->expects($this->once())->method('BindResources')->with($this->equalTo($bookableResources));
     $this->groupRepository->expects($this->once())->method('GetList')->will($this->returnValue($groupResult));
     $this->page->expects($this->once())->method('BindGroups')->with($this->equalTo($groups));
     $this->scheduleRepository->expects($this->once())->method('GetAll')->will($this->returnValue($schedules));
     $this->page->expects($this->once())->method('BindSchedules')->with($this->equalTo($schedules));
     $this->quotaRepository->expects($this->once())->method('GetAll')->will($this->returnValue($quotaList));
     $this->presenter->PageLoad();
 }
 public function testBindsUsersAndAttributesAndGroups()
 {
     $userId = 123;
     $pageNumber = 1;
     $pageSize = 10;
     $result = new UserItemView();
     $result->Id = $userId;
     $results = array($result);
     $userList = new PageableData($results);
     $resourceList = array(new FakeBookableResource(1));
     $attributeList = array(new FakeCustomAttribute(1, '1'));
     $this->page->expects($this->once())->method('GetPageNumber')->will($this->returnValue($pageNumber));
     $this->page->expects($this->once())->method('GetPageSize')->will($this->returnValue($pageSize));
     $this->page->expects($this->once())->method('GetFilterStatusId')->will($this->returnValue(AccountStatus::ALL));
     $this->userRepo->expects($this->once())->method('GetList')->with($this->equalTo($pageNumber), $this->equalTo($pageSize), $this->isNull(), $this->isNull(), $this->isNull(), $this->equalTo(AccountStatus::ALL))->will($this->returnValue($userList));
     $user = new FakeUser();
     $this->userRepo->expects($this->once())->method('LoadById')->with($this->fakeUser->UserId)->will($this->returnValue($user));
     $this->page->expects($this->once())->method('BindUsers')->with($this->equalTo($userList->Results()));
     $this->page->expects($this->once())->method('BindPageInfo')->with($this->equalTo($userList->PageInfo()));
     $this->resourceRepo->expects($this->once())->method('GetResourceList')->will($this->returnValue($resourceList));
     $this->page->expects($this->once())->method('BindResources')->with($this->equalTo($resourceList));
     $this->attributeService->expects($this->once())->method('GetByCategory')->with($this->equalTo(CustomAttributeCategory::USER))->will($this->returnValue($attributeList));
     $this->page->expects($this->once())->method('BindAttributeList')->with($this->equalTo($attributeList));
     $groups = array(new GroupItemView(1, 'gn'));
     $groupList = new PageableData($groups);
     $this->groupViewRepository->expects($this->once())->method('GetList')->will($this->returnValue($groupList));
     $this->page->expects($this->once())->method('BindGroups')->with($this->equalTo($groups));
     $this->presenter->PageLoad();
 }