public function testLoadsFilteredResultsAndChecksAuthorizationAgainstPendingReservations()
 {
     $pageNumber = 1;
     $pageSize = 40;
     $filter = new ReservationFilter();
     $data = new PageableData();
     $this->reservationViewRepository->expects($this->once())->method('GetList')->with($pageNumber, $pageSize, null, null, $filter->GetFilter())->will($this->returnValue($data));
     $actualData = $this->service->LoadFiltered($pageNumber, $pageSize, $filter, $this->fakeUser);
     $this->assertEquals($data, $actualData);
 }
 public function testLoadsFilteredResultsAndChecksAuthorizationAgainstPendingReservations()
 {
     $pageNumber = 1;
     $pageSize = 40;
     $groups = array(new UserGroup(1, '1'), new UserGroup(5, '5'), new UserGroup(9, '9'), new UserGroup(22, '22'));
     $myGroups = array(1, 5, 9, 22);
     $this->userRepository->expects($this->once())->method('LoadGroups')->with($this->equalTo($this->fakeUser->UserId), $this->equalTo(RoleLevel::RESOURCE_ADMIN))->will($this->returnValue($groups));
     $filter = new ReservationFilter();
     $expectedFilter = $filter->GetFilter();
     $expectedFilter->_And(new SqlFilterIn(new SqlFilterColumn(TableNames::RESOURCES, ColumnNames::RESOURCE_ADMIN_GROUP_ID), $myGroups));
     $data = new PageableData();
     $this->reservationViewRepository->expects($this->once())->method('GetList')->with($pageNumber, $pageSize, null, null, $expectedFilter)->will($this->returnValue($data));
     $actualData = $this->service->LoadFiltered($pageNumber, $pageSize, $filter, $this->fakeUser);
     $this->assertEquals($data, $actualData);
 }