public function testConflictHandlerReportsConflictingReservationAndDoesNotUpdateBlackout() { $userId = $this->fakeUser->UserId; $start = Date::Parse('2011-01-01 01:01:01'); $end = Date::Parse('2011-02-02 02:02:02'); $date = new DateRange($start, $end); $resourceId = 2; $resourceIds = array($resourceId); $title = 'title'; $seriesId = 111; $blackoutInstanceId = 10; $series = BlackoutSeries::Create(1, 'old title', new TestDateRange()); $series->WithId($seriesId); $user = $this->getMock('User'); $user->expects($this->any())->method('IsResourceAdminFor')->with($this->anything())->will($this->returnValue(true)); $this->userRepository->expects($this->once())->method('LoadById')->with($this->equalTo($userId))->will($this->returnValue($user)); $this->reservationViewRepository->expects($this->once())->method('GetBlackoutsWithin')->with($this->equalTo($date))->will($this->returnValue(array())); $reservation1 = new TestReservationItemView(1, $start, $end, 2); $reservation2 = new TestReservationItemView(2, $start, $end, 2); $this->reservationViewRepository->expects($this->once())->method('GetReservationList')->with($this->equalTo($start), $this->equalTo($end))->will($this->returnValue(array($reservation1, $reservation2))); $this->conflictHandler->expects($this->at(0))->method('Handle')->with($this->equalTo($reservation1))->will($this->returnValue(false)); $this->conflictHandler->expects($this->at(1))->method('Handle')->with($this->equalTo($reservation2))->will($this->returnValue(false)); $this->blackoutRepository->expects($this->never())->method('Update'); $this->blackoutRepository->expects($this->once())->method('LoadByBlackoutId')->with($this->equalTo($blackoutInstanceId))->will($this->returnValue($series)); $result = $this->service->Update($blackoutInstanceId, $date, $resourceIds, $title, $this->conflictHandler, new RepeatNone(), SeriesUpdateScope::FullSeries); $this->assertFalse($result->WasSuccessful()); }