Exemple #1
0
 private void TestCreateEmailAddresses(Member member, Type expectedType)
 {
     try
     {
         _membersCommand.CreateMember(member);
         Assert.Fail();
     }
     catch (ValidationErrorsException ex)
     {
         Assert.AreEqual(1, ex.Errors.Count);
         Assert.AreEqual("EmailAddresses", ex.Errors[0].Name);
         Assert.IsInstanceOfType(ex.Errors[0], expectedType);
     }
 }
Exemple #2
0
 private void AddMember(MemberContent content)
 {
     content.Member.Address = new Address {
         Location = _locationQuery.ResolveLocation(_locationQuery.GetCountry("Australia"), null)
     };
     _membersCommand.CreateMember(content.Member);
     content.Candidate.Id = content.Member.Id;
     _candidatesCommand.CreateCandidate(content.Candidate);
     _searchService.UpdateMember(content.Member.Id);
 }
Exemple #3
0
        private void CreateMember(Member member, Guid?affiliateId)
        {
            _membersCommand.CreateMember(member);

            var candidate = new Candidate
            {
                Id                   = member.Id,
                Status               = Defaults.CandidateStatus,
                DesiredJobTypes      = Defaults.DesiredJobTypes,
                RelocationPreference = Defaults.RelocationPreference,
            };

            _candidatesCommand.CreateCandidate(candidate);

            if (affiliateId != null)
            {
                _memberAffiliationsCommand.SetAffiliation(member.Id, affiliateId.Value);
            }
        }
Exemple #4
0
        protected Member CreateMember(int index, Action <Member, Candidate, Resume> initialiseMember)
        {
            var member = new Member
            {
                EmailAddresses = new List <EmailAddress> {
                    new EmailAddress {
                        Address = string.Format(EmailAddressFormat, index), IsVerified = true
                    }
                },
                FirstName = string.Format(FirstNameFormat, index),
                LastName  = string.Format(LastNameFormat, index),
                Address   = new Address {
                    Location = _locationQuery.ResolveLocation(_locationQuery.GetCountry("Australia"), null)
                },
                IsEnabled          = true,
                IsActivated        = true,
                VisibilitySettings = new VisibilitySettings {
                    Professional = { EmploymentVisibility = ProfessionalVisibility.All }
                },
            };
            var candidate = new Candidate
            {
                Status = CandidateStatus.ActivelyLooking,
            };
            var resume = new Resume
            {
                Objective = string.Format(ObjectiveFormat, index),
            };

            if (initialiseMember != null)
            {
                initialiseMember(member, candidate, resume);
            }

            _membersCommand.CreateMember(member);
            candidate.Id = member.Id;
            _candidatesCommand.CreateCandidate(candidate);
            _candidateResumesCommand.CreateResume(candidate, resume);

            _memberSearchService.UpdateMember(member.Id);
            return(member);
        }
        public static Member CreateTestMember(this IMembersCommand membersCommand, string emailAddress, string firstName, string lastName, DateTime?createdTime)
        {
            var member = new Member
            {
                IsEnabled      = true,
                IsActivated    = true,
                EmailAddresses = new List <EmailAddress> {
                    new EmailAddress {
                        Address = emailAddress, IsVerified = true
                    }
                },
                PhoneNumbers = new List <PhoneNumber> {
                    new PhoneNumber {
                        Number = DefaultPhoneNumber, Type = PhoneNumberType.Mobile
                    }
                },
                FirstName          = firstName,
                LastName           = lastName,
                Gender             = DefaultGender,
                DateOfBirth        = DefaultDateOfBirth,
                VisibilitySettings = new VisibilitySettings(),
            };

            if (createdTime.HasValue)
            {
                member.CreatedTime     = createdTime.Value;
                member.LastUpdatedTime = createdTime.Value;
            }

            // Deny public access to real name, because existing tests rely on this. Might need to change this later.

            member.VisibilitySettings.Personal.PublicVisibility &= ~PersonalVisibility.Name;

            member.Address = new Address {
                Location = new LocationReference()
            };
            _locationQuery.ResolvePostalSuburb(member.Address.Location, DefaultCountry, DefaultLocation);

            membersCommand.CreateMember(member);
            return(member);
        }
Exemple #6
0
        protected Member CreateMember(DateTime createdTime)
        {
            var member = new Member
            {
                FirstName      = FirstName,
                LastName       = LastName,
                EmailAddresses = new List <EmailAddress> {
                    new EmailAddress {
                        Address = EmailAddress
                    }
                },
                CreatedTime = createdTime,
                Address     = new Address {
                    Location = _locationQuery.ResolveLocation(_locationQuery.GetCountry(Country), null)
                },
                IsEnabled   = true,
                IsActivated = false,
            };

            _membersCommand.CreateMember(member);
            return(member);
        }