public void Registering_delegate_should_add_CandidateId_to_all_SupervisorDelegate_records_found_by_email() { // Given var supervisorDelegateIds = new List <int> { 1, 2, 3, 4, 5 }; var model = RegistrationModelTestHelper.GetDefaultDelegateRegistrationModel(); GivenPendingSupervisorDelegateIdsForEmailAre(supervisorDelegateIds); A.CallTo( () => userDataService.GetDelegateUserByCandidateNumber( NewCandidateNumber, RegistrationModelTestHelper.Centre ) ) .Returns(new DelegateUser { Id = 777 }); // When registrationService.RegisterDelegate(model, string.Empty, false, 999); // Then A.CallTo( () => supervisorDelegateService.AddDelegateIdToSupervisorDelegateRecords( A <IEnumerable <int> > .That.IsSameSequenceAs(supervisorDelegateIds), 777 ) ).MustHaveHappened(); }
private void SetUpSupervisorDelegateRelations(string emailAddress, int centreId, int delegateId) { var pendingSupervisorDelegateIds = supervisorDelegateService.GetPendingSupervisorDelegateRecordsByEmailAndCentre( centreId, emailAddress ).Select(supervisor => supervisor.ID).ToList(); if (!pendingSupervisorDelegateIds.Any()) { return; } supervisorDelegateService.AddDelegateIdToSupervisorDelegateRecords( pendingSupervisorDelegateIds, delegateId ); }