private Candidate CreateCandidateWithResumeFile() { // Create member. var member = _membersCommand.CreateTestMember(0); member.CreatedTime = DateTime.Now.AddDays(-10); _membersCommand.UpdateMember(member); // Create candidate. var candidate = new Candidate { Id = member.Id }; _candidatesCommand.CreateCandidate(candidate); // Create resume file. var fileReference = GetResumeFile(); var resume = new Resume { Citizenship = "Something" }; _candidateResumesCommand.CreateResume(candidate, resume, fileReference); return(candidate); }
void IMemberAccountsCommand.UpdateMember(Member member) { // Keep track of changes. var originalMember = _membersQuery.GetMember(member.Id); var originalCredentials = _loginCredentialsQuery.GetCredentials(member.Id); PrepareEmailAddresses(member, originalMember); // Save. _membersCommand.UpdateMember(member); // Because the email address is also the loginId that may need to be updated. // (Actually should only really update if the email has changed but there is an implementation quirk // where the member IsEnabled, IsActivated is stored in the same flags column as the credentials MustChangePassword). UpdateCredentials(member.Id, originalCredentials, member.EmailAddresses[0].Address); // Fire an event. var handlers = MemberUpdated; if (handlers != null) { handlers(this, new EventArgs <Member>(member)); } }
public void TestUpdateDuplicates() { _membersCommand.CreateTestMember(EmailAddress); var member = _membersCommand.CreateTestMember(1); member.EmailAddresses = new List <EmailAddress> { new EmailAddress { Address = EmailAddress } }; _membersCommand.UpdateMember(member); }
private IMember CreateMember() { var member = _membersCommand.CreateTestMember(0); member.Address.Location = _locationQuery.ResolveLocation(_locationQuery.GetCountry(Country), Location); _membersCommand.UpdateMember(member); var candidate = new Candidate { Id = member.Id }; _candidatesCommand.CreateCandidate(candidate); // Give them a resume. var resume = new Resume { Jobs = new List <Job> { new Job { Title = JobTitle } } }; _candidateResumesCommand.CreateResume(candidate, resume); return(member); }
private Member CreateMember(int index, bool isResumeVisible, bool isPhoneNumberVisible, bool hasPhoneNumbers) { var member = _membersCommand.CreateTestMember(index); if (hasPhoneNumbers) { member.PhoneNumbers = new List <PhoneNumber> { new PhoneNumber { Number = string.Format(MobilePhoneNumberFormat, index), Type = PhoneNumberType.Mobile }, new PhoneNumber { Number = string.Format(HomePhoneNumberFormat, index), Type = PhoneNumberType.Home }, new PhoneNumber { Number = string.Format(WorkPhoneNumberFormat, index), Type = PhoneNumberType.Work } }; } else { member.PhoneNumbers = null; } member.VisibilitySettings.Professional.EmploymentVisibility = isResumeVisible ? member.VisibilitySettings.Professional.EmploymentVisibility.SetFlag(ProfessionalVisibility.Resume) : member.VisibilitySettings.Professional.EmploymentVisibility.ResetFlag(ProfessionalVisibility.Resume); member.VisibilitySettings.Professional.EmploymentVisibility = isPhoneNumberVisible ? member.VisibilitySettings.Professional.EmploymentVisibility.SetFlag(ProfessionalVisibility.PhoneNumbers) : member.VisibilitySettings.Professional.EmploymentVisibility.ResetFlag(ProfessionalVisibility.PhoneNumbers); _membersCommand.UpdateMember(member); return(member); }
public void TestPrimaryEmailAddress() { var member = _membersCommand.CreateTestMember(0); member.EmailAddresses.Add(new EmailAddress { Address = SecondaryEmailAddress, IsVerified = true }); _membersCommand.UpdateMember(member); member = _membersQuery.GetMember(member.Id); Assert.IsTrue(member.EmailAddresses[0].IsVerified); AssertBestEmailAddress(member.EmailAddresses[0].Address, true, member); // Unverify the address. _emailVerificationsCommand.UnverifyEmailAddress(member.EmailAddresses[0].Address, null); // Assert. member = _membersQuery.GetMember(member.Id); Assert.IsFalse(member.EmailAddresses[0].IsVerified); Assert.IsTrue(member.EmailAddresses[1].IsVerified); AssertBestEmailAddress(member.EmailAddresses[1].Address, true, member); }
private Member CreateMember(int index, bool isResumeVisible, bool hasResume) { var member = _membersCommand.CreateTestMember(index); var candidate = new Candidate { Id = member.Id }; _candidatesCommand.CreateCandidate(candidate); if (hasResume) { _candidateResumesCommand.AddTestResume(candidate); } member.VisibilitySettings.Professional.EmploymentVisibility = isResumeVisible ? member.VisibilitySettings.Professional.EmploymentVisibility.SetFlag(ProfessionalVisibility.Resume) : member.VisibilitySettings.Professional.EmploymentVisibility.ResetFlag(ProfessionalVisibility.Resume); _membersCommand.UpdateMember(member); return(member); }
protected Member CreateMember() { var member = CreateMember(0); member.Address.Location = _locationQuery.ResolveLocation(_locationQuery.GetCountry(Country), Location); _membersCommand.UpdateMember(member); // Give them a resume. var candidate = _candidatesCommand.GetCandidate(member.Id); var resume = new Resume { Jobs = new List <Job> { new Job { Title = Title } } }; _candidateResumesCommand.CreateResume(candidate, resume); return(member); }
public void TestDisabledFriend() { var member = _membersCommand.CreateTestMember(0); var friends = CreateFriends(member.Id, 1, 3); // Disable. friends[1].IsEnabled = false; _membersCommand.UpdateMember(friends[1]); AssertFriends(member.Id, friends.Take(1).Concat(friends.Skip(2).Take(1)).ToList(), friends.Skip(1).Take(1)); // Disable another. friends[0].IsEnabled = false; _membersCommand.UpdateMember(friends[0]); AssertFriends(member.Id, friends.Skip(2).ToList(), friends.Take(2)); // Enable. friends[1].IsEnabled = true; _membersCommand.UpdateMember(friends[1]); AssertFriends(member.Id, friends.Skip(1).ToList(), friends.Take(1)); }
public void TestFriendDisabled() { Member start, friend1, friend2, friend3, second1, second2, second3; CreateMembers(out start, out friend1, out friend2, out friend3, out second1, out second2, out second3); // Disable. friend3.IsEnabled = false; _membersCommand.UpdateMember(friend3); var contacts = _memberContactsQuery.GetSecondDegreeContacts(start.Id, 0); AssertAreEqual( contacts, new Dictionary <Guid, Guid[]> { { second1.Id, new[] { friend1.Id, friend2.Id } }, { second2.Id, new[] { friend2.Id } } }); }
public void TestByName() { var member = _memberAccountsCommand.CreateTestMember(0); var activated = _memberAccountsCommand.CreateTestMember(EmailAddress1, FirstName, LastName1); var deactivated = _memberAccountsCommand.CreateTestMember(EmailAddress2, FirstName, LastName2); activated.VisibilitySettings.Personal.Set(PersonalContactDegree.Public, PersonalVisibility.Name); _memberAccountsCommand.UpdateMember(activated); deactivated.IsActivated = false; deactivated.VisibilitySettings.Personal.Set(PersonalContactDegree.Public, PersonalVisibility.Name); _memberAccountsCommand.UpdateMember(deactivated); TestByName(member.Id, activated.Id, deactivated.Id); }