Exemplo n.º 1
0
 private static EducationModel CreateEducationModel(ICandidate candidate, IResume resume)
 {
     return(new EducationModel
     {
         Member = new EducationMemberModel
         {
             HighestEducationLevel = candidate.HighestEducationLevel,
             Schools = resume == null || resume.Schools == null
                 ? new List <SchoolModel>
             {
                 new SchoolModel()
             }
                 : (from s in resume.Schools
                    select new SchoolModel
             {
                 Id = s.Id,
                 EndDate = s.CompletionDate == null ? null : s.CompletionDate.End,
                 Degree = s.Degree,
                 Major = s.Major,
                 Institution = s.Institution,
                 City = s.City,
                 Description = s.Description,
                 IsCurrent = s.IsCurrent,
             }).ToList()
         },
         Reference = new EducationReferenceModel
         {
             Months = Months,
             Years = SchoolYears,
         },
     });
 }
Exemplo n.º 2
0
 private static EmploymentHistoryModel CreateEmploymentHistoryModel(ICandidate candidate, IResume resume, IList <Industry> industries)
 {
     return(new EmploymentHistoryModel
     {
         Member = new EmploymentHistoryMemberModel
         {
             RecentProfession = candidate.RecentProfession,
             RecentSeniority = candidate.RecentSeniority,
             IndustryIds = candidate.Industries == null ? new List <Guid>() : candidate.Industries.Select(i => i.Id).ToList(),
             Jobs = resume == null || resume.Jobs == null
                 ? new List <JobModel>
             {
                 new JobModel()
             }
                 : (from j in resume.Jobs
                    select new JobModel
             {
                 Id = j.Id,
                 Company = j.Company,
                 Description = j.Description,
                 StartDate = j.Dates == null ? null : j.Dates.Start,
                 EndDate = j.Dates == null ? null : j.Dates.End,
                 Title = j.Title,
                 IsCurrent = j.IsCurrent,
             }).ToList()
         },
         Reference = new EmploymentHistoryReferenceModel
         {
             Industries = industries,
             Months = Months,
             Years = JobYears,
         },
     });
 }
Exemplo n.º 3
0
            public void Evaluate(ICandidate candidate)
            {
                var sti = (STIntegerWUTestCase
                           )candidate.GetObject();

                candidate.Include((((int)sti.i_int) + 2) > 100);
            }
Exemplo n.º 4
0
        private DesiredJobModel CreateDesiredJobModel(IMember member, ICandidate candidate, IList <Country> countries)
        {
            var visibility = member.VisibilitySettings.Professional.EmploymentVisibility;
            var country    = ActivityContext.Location.Country;

            return(new DesiredJobModel
            {
                Member = new DesiredJobMemberModel
                {
                    SendSuggestedJobs = GetSuggestedJobsEmailSetting(member.Id),
                    DesiredJobTitle = candidate.DesiredJobTitle,
                    DesiredJobTypes = candidate.DesiredJobTypes,
                    Status = candidate.Status,
                    DesiredSalaryLowerBound = candidate.DesiredSalary == null ? null : candidate.DesiredSalary.LowerBound,
                    DesiredSalaryRate = candidate.DesiredSalary == null ? Defaults.DesiredSalaryRate : candidate.DesiredSalary.Rate,
                    IsSalaryNotVisible = !visibility.IsFlagSet(ProfessionalVisibility.Salary),
                    RelocationPreference = candidate.RelocationPreference,
                    RelocationCountryIds = candidate.RelocationLocations.GetRelocationCountryIds(),
                    RelocationCountryLocationIds = candidate.RelocationLocations.GetRelocationCountryLocationIds(country),
                },
                Reference = new DesiredJobReferenceModel
                {
                    Countries = countries,
                    CountrySubdivisions = (from s in _locationQuery.GetCountrySubdivisions(country) where !s.IsCountry select s).ToList(),
                    Regions = _locationQuery.GetRegions(country),
                    CurrentCountry = country,
                    SalaryRates = SalaryRates,
                },
            });
        }
Exemplo n.º 5
0
            public void Evaluate(ICandidate candidate)
            {
                var sts = (STStringTestCase
                           )candidate.GetObject();

                candidate.Include(sts.str.ToLower().IndexOf("od") >= 0);
            }
Exemplo n.º 6
0
        public void Test_OneBetterThanNext_Candidate(ICandidate current, ICandidate next, JobRelevantSkills job)
        {
            var dataAService = new DataAnalysingService();
            var result       = dataAService.CurrentCandidateIsBetterThanNextOne(current, next, job);

            Assert.False(result);
        }
Exemplo n.º 7
0
        private static NameValueCollection GetParameters(ICandidate candidate, ISchool school)
        {
            var parameters = new NameValueCollection
            {
                { "HighestEducationLevel", candidate.HighestEducationLevel == null ? null : candidate.HighestEducationLevel.Value.ToString() },
            };

            if (school != null)
            {
                if (school.Id != Guid.Empty)
                {
                    parameters.Add("Id", school.Id.ToString());
                }
                parameters.Add("City", school.City);
                parameters.Add("Degree", school.Degree);
                parameters.Add("Description", school.Description);
                parameters.Add("Institution", school.Institution);
                parameters.Add("Major", school.Major);
                parameters.Add("EndDateMonth", school.CompletionDate == null || school.CompletionDate.End == null || school.CompletionDate.End.Value.Month == null ? null : school.CompletionDate.End.Value.Month.Value.ToString());
                parameters.Add("EndDateYear", school.CompletionDate == null || school.CompletionDate.End == null ? null : school.CompletionDate.End.Value.Year.ToString());
                parameters.Add("IsCurrent", (school.CompletionDate != null && school.CompletionDate.End == null).ToString());
            }

            return(parameters);
        }
Exemplo n.º 8
0
        public void Evaluate(ICandidate candidate)
        {
            // use starting _ for PascalCase conversion purposes
            var _predicate = (Predicate <T>)GetContent();

            candidate.Include(_predicate((T)candidate.GetObject()));
        }
Exemplo n.º 9
0
            public void Evaluate(ICandidate candidate)
            {
                var sts = (STByteWUTestCase
                           )candidate.GetObject();

                candidate.Include((((byte)sts.i_byte) + 2) > 100);
            }
Exemplo n.º 10
0
        /// <summary>
        /// Determine whether an update is needed to the resume/profile based on candidate's status
        /// In the absence of a update date/time on the resume the member's creation date/time is used
        /// </summary>
        /// <param name="member"></param>
        /// <param name="candidate"></param>
        /// <param name="resume"></param>
        /// <returns>true is the profile needs to be updated; false otherwise</returns>
        bool IMemberStatusQuery.IsUpdateNeeded(IMember member, ICandidate candidate, IResume resume)
        {
            DateTime lastUpdatedBefore;

            switch (candidate.Status)
            {
            case CandidateStatus.AvailableNow:
                lastUpdatedBefore = DateTime.Now.AddDays(-1 * UpdateIntervalAvailableNow);
                break;

            case CandidateStatus.ActivelyLooking:
                lastUpdatedBefore = DateTime.Now.AddDays(-1 * UpdateIntervalActivelyLooking);
                break;

            case CandidateStatus.NotLooking:
                lastUpdatedBefore = DateTime.Now.AddDays(-1 * UpdateIntervalNotLooking);
                break;

            case CandidateStatus.OpenToOffers:
                lastUpdatedBefore = DateTime.Now.AddDays(-1 * UpdateIntervalOpenToOffers);
                break;

            default:
                lastUpdatedBefore = DateTime.Now.AddDays(-1 * UpdateIntervalUnspecified);
                break;
            }

            return(GetLastUpdatedTime(member, candidate, resume) < lastUpdatedBefore);
        }
Exemplo n.º 11
0
        private void AssertCandidate(bool canAccessSalary, ICandidate candidate)
        {
            // Should be able to access all these no matter what.

            Assert.AreEqual(Status, candidate.Status);
            Assert.AreEqual(DesiredJobTitle, candidate.DesiredJobTitle);
            Assert.AreEqual(DesiredJobTypes, candidate.DesiredJobTypes);

            if (canAccessSalary)
            {
                Assert.AreEqual(DesiredSalary, candidate.DesiredSalary);
            }
            else
            {
                Assert.IsNull(candidate.DesiredSalary);
            }

            Assert.IsTrue(_industries.CollectionEqual(candidate.Industries));
            Assert.IsTrue(_relocationLocations.CollectionEqual(candidate.RelocationLocations));
            Assert.AreEqual(RelocationPreference, candidate.RelocationPreference);
            Assert.AreEqual(HighestEducationLevel, candidate.HighestEducationLevel);
            Assert.AreEqual(RecentSeniority, candidate.RecentSeniority);
            Assert.AreEqual(RecentProfession, candidate.RecentProfession);
            Assert.AreEqual(VisaStatus, candidate.VisaStatus);
        }
Exemplo n.º 12
0
        private static NameValueCollection GetParameters(IMember member, ICandidate candidate, IResume resume)
        {
            var primaryEmailAddress   = member.GetPrimaryEmailAddress();
            var secondaryEmailAddress = member.GetSecondaryEmailAddress();
            var primaryPhoneNumber    = member.GetPrimaryPhoneNumber();
            var secondaryPhoneNumber  = member.GetSecondaryPhoneNumber();

            return(new NameValueCollection
            {
                { "FirstName", member.FirstName },
                { "LastName", member.LastName },
                { "CountryId", member.Address.Location.Country.Id.ToString() },
                { "Location", member.Address.Location.ToString() },
                { "EmailAddress", primaryEmailAddress == null ? null : primaryEmailAddress.Address },
                { "SecondaryEmailAddress", secondaryEmailAddress == null ? null : secondaryEmailAddress.Address },
                { "PhoneNumber", primaryPhoneNumber.Number },
                { "PhoneNumberType", primaryPhoneNumber.Type.ToString() },
                { "SecondaryPhoneNumber", secondaryPhoneNumber == null ? null : secondaryPhoneNumber.Number },
                { "SecondaryPhoneNumberType", secondaryPhoneNumber == null ? null : secondaryPhoneNumber.Type.ToString() },
                { "Citizenship", resume == null ? null : resume.Citizenship },
                { "VisaStatus", candidate.VisaStatus == null ? null : candidate.VisaStatus.Value.ToString() },
                { "Aboriginal", member.EthnicStatus.IsFlagSet(EthnicStatus.Aboriginal) ? "true" : "false" },
                { "TorresIslander", member.EthnicStatus.IsFlagSet(EthnicStatus.TorresIslander) ? "true" : "false" },
                { "Gender", member.Gender == Gender.Male ? "Male" : member.Gender == Gender.Female ? "Female" : null },
                { "DateOfBirthMonth", member.DateOfBirth == null || member.DateOfBirth.Value.Month == null ? null : member.DateOfBirth.Value.Month.Value.ToString() },
                { "DateOfBirthYear", member.DateOfBirth == null ? null : member.DateOfBirth.Value.Year.ToString() },
            });
        }
Exemplo n.º 13
0
        private static NameValueCollection GetParameters(IMember member, ICandidate candidate, bool sendSuggestedJobs)
        {
            var parameters = new NameValueCollection
            {
                { "DesiredJobTitle", candidate.DesiredJobTitle },
                { "DesiredSalaryLowerBound", candidate.DesiredSalary == null || candidate.DesiredSalary.LowerBound == null ? null : candidate.DesiredSalary.LowerBound.Value.ToString() },
                { "DesiredSalaryRate", candidate.DesiredSalary == null ? null : candidate.DesiredSalary.Rate.ToString() },
                { "FullTime", candidate.DesiredJobTypes.IsFlagSet(JobTypes.FullTime) ? "true" : "false" },
                { "PartTime", candidate.DesiredJobTypes.IsFlagSet(JobTypes.PartTime) ? "true" : "false" },
                { "Contract", candidate.DesiredJobTypes.IsFlagSet(JobTypes.Contract) ? "true" : "false" },
                { "Temp", candidate.DesiredJobTypes.IsFlagSet(JobTypes.Temp) ? "true" : "false" },
                { "JobShare", candidate.DesiredJobTypes.IsFlagSet(JobTypes.JobShare) ? "true" : "false" },
                { "Status", candidate.Status.ToString() },
                { "IsSalaryNotVisible", member.VisibilitySettings.Professional.EmploymentVisibility.IsFlagSet(ProfessionalVisibility.Salary) ? "false" : "true" },
                { "SendSuggestedJobs", sendSuggestedJobs ? "true" : "false" },
                { "RelocationPreference", candidate.RelocationPreference.ToString() },
            };

            if (candidate.RelocationLocations != null && candidate.RelocationLocations.Count > 0)
            {
                foreach (var location in candidate.RelocationLocations.Where(l => l.IsCountry))
                {
                    parameters.Add("RelocationCountryIds", location.Country.Id.ToString());
                }
                foreach (var location in candidate.RelocationLocations.Where(l => !l.IsCountry))
                {
                    parameters.Add("RelocationCountryLocationIds", location.NamedLocation.Id.ToString());
                }
            }

            return(parameters);
        }
Exemplo n.º 14
0
        protected override void AssertMember(IMember member, ICandidate candidate, IResume resume)
        {
            Assert.AreEqual(candidate.HighestEducationLevel == null ? "" : candidate.HighestEducationLevel.Value.ToString(), _highestEducationLevelDropDownList.SelectedItem.Value);

            // The first school is displayed.

            var school = resume == null || resume.Schools == null || resume.Schools.Count == 0
                ? null
                : resume.Schools[0];

            if (school == null)
            {
                Assert.AreEqual("", _endDateMonthDropDownList.SelectedItem.Value);
                Assert.AreEqual("", _endDateYearDropDownList.SelectedItem.Value);
                Assert.AreEqual("", _degreeTextBox.Text);
                Assert.AreEqual("", _majorTextBox.Text);
                Assert.AreEqual("", _institutionTextBox.Text);
                Assert.AreEqual("", _cityTextBox.Text);
                Assert.AreEqual("", _descriptionTextBox.Text.Trim());
            }
            else
            {
                Assert.AreEqual(school.CompletionDate == null || school.CompletionDate.End == null || school.CompletionDate.End.Value.Month == null ? "" : school.CompletionDate.End.Value.Month.Value.ToString(CultureInfo.InvariantCulture), _endDateMonthDropDownList.SelectedItem.Value);
                Assert.AreEqual(school.CompletionDate == null || school.CompletionDate.End == null ? "" : school.CompletionDate.End.Value.Year.ToString(CultureInfo.InvariantCulture), _endDateYearDropDownList.SelectedItem.Value);
                Assert.AreEqual(school.Degree, _degreeTextBox.Text);
                Assert.AreEqual(school.Major, _majorTextBox.Text);
                Assert.AreEqual(school.Institution, _institutionTextBox.Text);
                Assert.AreEqual(school.City, _cityTextBox.Text);
                Assert.AreEqual(school.Description, _descriptionTextBox.Text.Trim());
            }
        }
        public bool CurrentCandidateIsBetterThanNextOne(ICandidate current, ICandidate next, IJobRelevantSkills jobRequiredSkill)
        {
            foreach (var skill in jobRequiredSkill.NormalizedSkillSet.OrderByDescending(s => s.Value).Select(s => s.Key).ToList())
            {
                if (current.skillSet.ContainsKey(skill) && next.skillSet.ContainsKey(skill))
                {
                    // 1 is strongest n is weakest, current one may have stronger skil of what job required
                    if (current.skillSet[skill] < next.skillSet[skill])
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }

                else if (current.skillSet.ContainsKey(skill) && !next.skillSet.ContainsKey(skill))
                {
                    return(true); // current one is better than next one , ready to re-order
                }
                else if (!current.skillSet.ContainsKey(skill) && next.skillSet.ContainsKey(skill))
                {
                    return(false); // next one is better . no need to re-order
                }
            }

            return(false);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Does c1 dominate c2?
        /// </summary>
        /// <param name="c1">the subject candidate, c1 (does this dominate...).</param>
        /// <param name="c2">the object candidate, c2 (is dominated by).</param>
        /// <returns></returns>
        private static Boolean dominatesDiversity(ICandidate c1, ICandidate c2)
        {
            var Dominates = false;

            for (int i = 0; i < numObjectives; i++)
            {
                double c1Value = 0.0, c2Value = 0.0;
                for (int j = 0; j < numObjectives; j++)
                {
                    if (j == i)
                    {
                        c1Value += (int)optDirections[j] * c1.objectives[j] / Math.Abs(c2.objectives[j]);
                        c2Value += (int)optDirections[j] * Math.Sign(c2.objectives[j]);
                    }
                    else
                    {
                        c1Value += (int)optDirections[j] * alpha * c1.objectives[j] / Math.Abs(c2.objectives[j]);
                        c2Value += (int)optDirections[j] * alpha *Math.Sign(c2.objectives[j]);
                    }
                }
                if (c1Value < c2Value)
                {
                    return(false);
                }
                if (c1Value > c2Value)
                {
                    Dominates = true;
                }
            }
            return(Dominates);
        }
Exemplo n.º 17
0
        /// <summary>
        /// Does c1 dominate c2?
        /// </summary>
        /// <param name="c1">the subject candidate, c1 (does this dominate...).</param>
        /// <param name="c2">the object candidate, c2 (is dominated by).</param>
        /// <returns></returns>
        private static Boolean dominatesWithWeights(ICandidate c1, ICandidate c2)
        {
            var Dominates = false;

            for (int i = 0; i < numObjectives; i++)
            {
                double c1Value = 0.0, c2Value = 0.0;
                for (int j = 0; j < numObjectives; j++)
                {
                    if (j == i)
                    {
                        c1Value += (int)optDirections[j] * weights[j] * c1.objectives[j];
                        c2Value += (int)optDirections[j] * weights[j] * c2.objectives[j];
                    }
                    else
                    {
                        c1Value += (int)optDirections[j] * alpha * weights[j] * c1.objectives[j];
                        c2Value += (int)optDirections[j] * alpha * weights[j] * c2.objectives[j];
                    }
                }
                if (c1Value < c2Value)
                {
                    return(false);
                }
                if (c1Value > c2Value)
                {
                    Dominates = true;
                }
            }
            return(Dominates);
        }
Exemplo n.º 18
0
        private ICandidate FindDefaultCandidate()
        {
            ICandidate candidateToFind = _context.DefaultCandidate;

            if (candidateToFind == null)
            {
                return(null);
            }

            foreach (ICandidate candidate in Candidates)
            {
                if (ReferenceEquals(candidateToFind, candidate))
                {
                    return(candidate);
                }

                var enhancedCandidate = candidate as EnhancedParameterInfoCandidate;
                if (enhancedCandidate != null && ReferenceEquals(enhancedCandidate.UnderlyingCandidate, candidateToFind))
                {
                    return(enhancedCandidate);
                }
            }

            return(null);
        }
Exemplo n.º 19
0
            public void Evaluate(ICandidate candidate)
            {
                var sts = (STCharWUTestCase
                           )candidate.GetObject();

                candidate.Include((((char)sts.i_char) + 2) > 100);
            }
        public void Evaluate(ICandidate candidate)
        {
            // use starting _ for PascalCase conversion purposes
            EvaluationDelegate _evaluation = GetEvaluationDelegate();

            _evaluation(candidate);
        }
		private ICandidate[] Enhance([NotNull] ICandidate[] candidates) {
			int length = candidates.Length;
			var wrappedCandidates = new ICandidate[length];
			for (int i = 0; i < length; i++)
				wrappedCandidates[i] = Enhance(candidates[i]);
			return wrappedCandidates;
		}
Exemplo n.º 22
0
            public void Evaluate(ICandidate candidate)
            {
                var sts = (STShortWUTestCase
                           )candidate.GetObject();

                candidate.Include((((short)sts.i_short) + 2) > 100);
            }
 public virtual void Evaluate(ICandidate candidate)
 {
     var pe = (ParameterizedEvaluationTestCase) candidate.GetObject
         ();
     var inc = pe.str.IndexOf(str) != -1;
     candidate.Include(inc);
 }
Exemplo n.º 24
0
                public ICandidate mate(ICandidate other)
                {
                    valueCanidate child = new valueCanidate(obj.mate(myVal, ((valueCanidate)other).myVal), obj);

                    child.toOptimze = toOptimze;
                    return(child);
                }
            public UserWithParameters InstanciateNew(ICandidate <UserWithParameters> candidate)
            {
                var id   = candidate.Value.Id;
                var name = candidate.Value.Name;

                return(new UserWithParameters(id, name));
            }
Exemplo n.º 26
0
        public void CreateNextGeneration()
        {
            nextGeneration = new List <ICandidate>(100);
            do
            {
                var parentA = SelectOne();
                var parentB = SelectOne();

                var probability = randomHelper.GetProbability();
                var children    = new ICandidate[] { parentA, parentB };
                if (probability < CrossOverRate)
                {
                    var crossOverPoint = randomHelper.GetRandomInt(1, geneCount - 1);
                    children = CrossOver(parentA, parentB, crossOverPoint);
                }

                children[0].Mutate(MutationRate);
                children[1].Mutate(MutationRate);

                nextGeneration.AddRange(children);
            } while (nextGeneration.Count < PopulationSize);

            currentGeneration = nextGeneration;
            nextGeneration    = null;
            generationCount++;
        }
Exemplo n.º 27
0
        private void AssertResume(ICandidate candidate, IResume resume, FileReference fileReference)
        {
            Assert.IsNotNull(resume);
            var resumeFile = _candidateResumeFilesQuery.GetResumeFile(candidate.Id, fileReference.Id);

            Assert.AreEqual(fileReference.Id, resumeFile.FileReferenceId);
        }
            public virtual void Evaluate(ICandidate candidate)
            {
                ParameterizedEvaluationTestCase pe = (ParameterizedEvaluationTestCase)candidate.GetObject
                                                         ();
                bool inc = pe.str.IndexOf(str) != -1;

                candidate.Include(inc);
            }
Exemplo n.º 29
0
        protected void TestErrors(Guid instanceId, IMember member, ICandidate candidate, string password, string confirmPassword, bool acceptTerms, params string[] expectedErrorMessages)
        {
            SubmitPersonalDetails(instanceId, member, candidate, password, confirmPassword, acceptTerms);
            AssertUrl(GetPersonalDetailsUrl(instanceId));

            AssertErrorMessages(expectedErrorMessages);
            AssertPersonalDetails(instanceId, member, candidate, password, confirmPassword, acceptTerms);
        }
Exemplo n.º 30
0
        public override void HoldElection(ICandidate localCandidate, IList<ICandidate> allCandidates)
        {
            Console.WriteLine("Election instigated by '{0}'.", localCandidate.Uri);

            base.HoldElection(localCandidate, allCandidates);

            Console.WriteLine("Election instigated by '{0}' COMPLETED.", localCandidate.Uri);
        }
Exemplo n.º 31
0
 private MemberModel CreateMemberModel(IMember member, ICandidate candidate, IResume resume)
 {
     return(new MemberModel
     {
         Status = CreateStatusModel(member, candidate, resume),
         Visibility = CreateVisibilityModel(member),
     });
 }
Exemplo n.º 32
0
        private ICandidate Enhance([NotNull] ICandidate candidate)
        {
            var typedCandidate = candidate as ParameterInfoCandidate;

            return(typedCandidate != null
                                ? new EnhancedParameterInfoCandidate(typedCandidate, _colorizerPresenter, _settings)
                                : candidate);
        }
Exemplo n.º 33
0
        private void AssertFriend(Member friend, ICandidate candidate, IResume resume)
        {
            AssertPageContains(friend.FullName);

            var viewer = new PersonalView(friend, PersonalContactDegree.FirstDegree, PersonalContactDegree.FirstDegree);

            // Current Jobs.

            if (viewer.CanAccess(PersonalVisibility.CurrentJobs))
            {
                AssertPageContains(resume.GetCurrentJobsDisplayHtml());
            }
            else
            {
                AssertPageDoesNotContain(resume.GetCurrentJobsDisplayHtml());
            }

            // Candidate Status.

            if (viewer.CanAccess(PersonalVisibility.CandidateStatus))
            {
                if (candidate.Status != CandidateStatus.Unspecified)
                {
                    AssertPageContains(NetworkerFacade.GetCandidateStatusText(candidate.Status));
                }
            }
            else
            {
                if (candidate.Status != CandidateStatus.Unspecified)
                {
                    AssertPageDoesNotContain(NetworkerFacade.GetCandidateStatusText(candidate.Status));
                }
            }

            // Suburb.

            if (viewer.CanAccess(PersonalVisibility.Suburb))
            {
                AssertPageContains(friend.Address.Location.Suburb);
                AssertPageContains(" " + friend.Address.Location.Postcode);
            }
            else
            {
                AssertPageDoesNotContain(friend.Address.Location.Suburb);
                AssertPageDoesNotContain(" " + friend.Address.Location.Postcode); // GUIDs can contain "3143", too!
            }

            // CountrySubdivision.

            if (viewer.CanAccess(PersonalVisibility.CountrySubdivision))
            {
                AssertPageContains(friend.Address.Location.CountrySubdivision.ShortName);
            }
            else
            {
                AssertPageDoesNotContain(friend.Address.Location.CountrySubdivision.ShortName);
            }
        }
Exemplo n.º 34
0
 public CoordinatorElectionScheduler(IElectionsOfficer electionsOfficer, 
                                     IList<ICandidate> candidates, 
                                     object lockObject)
 {
     _electionsOfficer = electionsOfficer;
     _candidates = candidates;
     _lockObject = lockObject;
     _localCandidate = _candidates.First(c => c.IsLocal);
 }
Exemplo n.º 35
0
        public virtual CandidateStatus SendElectionNotification(ICandidate candidate)
        {
            if (candidate.IsLocal) { throw new Exception("candidate must not be local (i.e. associated with another process)"); }

            using (ZmqContext context = ZmqContext.Create())
            using (ZmqSocket client = context.CreateSocket(SocketType.REQ))
            {
                client.Connect(candidate.Uri);
                client.ReceiveTimeout = TimeSpan.FromSeconds(CoordinatorElectionScheduler.ElectionMessageReceiveTimeoutSeconds);
                client.Send(CoordinatorElectionScheduler.ElectionMessage, Encoding.Unicode);
                var reply = client.Receive(Encoding.Unicode);
                client.Linger = TimeSpan.FromSeconds(CoordinatorElectionScheduler.ElectionMessageReceiveSocketLingerSeconds); //required
                client.Close(); //required

                return reply == CoordinatorElectionScheduler.OkMessage ? CandidateStatus.Ok : CandidateStatus.NotOk;
            }
        }
Exemplo n.º 36
0
        public virtual void HoldElection(ICandidate localCandidate, IList<ICandidate> allCandidates)
        {
            if (!localCandidate.IsLocal) { throw new Exception("localCandidate must be local (i.e. associated with the current process)"); }

            if (!localCandidate.MoreAuthoritativeCandidateIds.Any())
            {
                CoordinatorElectionScheduler.IsCoordinatorProcess = true;

                return;
            }

            foreach (var id in localCandidate.MoreAuthoritativeCandidateIds.OrderByDescending(i => i))
            {
                if (SendElectionNotification(allCandidates[id]) == CandidateStatus.Ok)
                {
                    CoordinatorElectionScheduler.IsCoordinatorProcess = false;

                    return;
                }
            }

            CoordinatorElectionScheduler.IsCoordinatorProcess = true;
        }
Exemplo n.º 37
0
 public virtual void Evaluate(ICandidate candidate)
 {
     candidate.Include(_predicate.AppliesTo(candidate.GetObject()));
 }
Exemplo n.º 38
0
 public void Evaluate(ICandidate candidate)
 {
     candidate.Include(candidate.GetObject().ToString().ToLower().StartsWith("hell"));
 }
Exemplo n.º 39
0
 public void AddCandidate(ICandidate candidate)
 {
     //Assert.IsTrue(candidatesManager.AddCandidate()); // Test logic + Assertion
 }
Exemplo n.º 40
0
 public void Evaluate(ICandidate candidate)
 {
     var sts = (STStringTestCase
         ) candidate.GetObject();
     candidate.Include(sts.str.ToLower().IndexOf("od") >= 0);
 }
Exemplo n.º 41
0
 public virtual void Evaluate(ICandidate candidate)
 {
     var ci = (CaseInsensitiveTestCase) candidate.GetObject();
     candidate.Include(ci.name.ToLower().Equals(name.ToLower()));
 }
Exemplo n.º 42
0
		public void Evaluate(ICandidate candidate)
		{
			Car car=(Car)candidate.GetObject();
			candidate.Include(car.History.Count % 2 == 0);
		}
Exemplo n.º 43
0
			public void Evaluate(ICandidate candidate)
			{
				ISTInterface sti = (ISTInterface)candidate.GetObject();
				candidate.Include(sti.ReturnSomething().Equals("aaa"));
			}
Exemplo n.º 44
0
			public void Evaluate(ICandidate candidate)
			{
				Db4objects.Db4o.Tests.Common.Soda.Wrapper.Untyped.STIntegerWUTestCase sti = (Db4objects.Db4o.Tests.Common.Soda.Wrapper.Untyped.STIntegerWUTestCase
					)candidate.GetObject();
				candidate.Include((((int)sti.i_int) + 2) > 100);
			}
Exemplo n.º 45
0
 public void Evaluate(ICandidate candidate)
 {
     var sts = (STByteWUTestCase
         ) candidate.GetObject();
     candidate.Include((((byte) sts.i_byte) + 2) > 100);
 }
Exemplo n.º 46
0
		public void Evaluate(ICandidate candidate)
		{
			Person realCandidate = (Person)candidate.GetObject();
			candidate.Include(realCandidate.Name == _name);
		}
Exemplo n.º 47
0
 public void Evaluate(ICandidate candidate)
 {
     CsEvaluationDelegate obj = ((CsEvaluationDelegate)candidate.GetObject());
     candidate.Include(obj.name.Equals(_name));
 }
Exemplo n.º 48
0
 public void Evaluate(ICandidate candidate)
 {
     var sts = (STShortWUTestCase
         ) candidate.GetObject();
     candidate.Include((((short) sts.i_short) + 2) > 100);
 }
Exemplo n.º 49
0
        public override CandidateStatus SendElectionNotification(ICandidate candidate)
        {
            Console.WriteLine("Sending election notification to '{0}'.", candidate.Uri);

            return base.SendElectionNotification(candidate);
        }
Exemplo n.º 50
0
 public static void Evaluate(ICandidate candidate)
 {
     var obj = ((CsEvaluationDelegate) candidate.GetObject());
     candidate.Include(obj.name.Equals("three"));
 }
Exemplo n.º 51
0
 public void Evaluate(ICandidate candidate)
 {
     var sti = (STIntegerWUTestCase
         ) candidate.GetObject();
     candidate.Include((((int) sti.i_int) + 2) > 100);
 }
			public virtual void Evaluate(ICandidate candidate)
			{
				candidate.Include(true);
			}
Exemplo n.º 53
0
			public void Evaluate(ICandidate candidate)
			{
				PlainObjectTestCase.Item item = (PlainObjectTestCase.Item)candidate.GetObject();
				candidate.Include(item._plainObject == plainObject);
			}
Exemplo n.º 54
0
 public void Evaluate(ICandidate candidate)
 {
     var item = (Item) candidate.GetObject();
     candidate.Include(item._plainObject == plainObject);
 }
Exemplo n.º 55
0
 public void Evaluate(ICandidate candidate)
 {
     string stringValue = (string)candidate.GetObject();
     candidate.Include(pattern.IsMatch(stringValue));
 }
Exemplo n.º 56
0
 internal static void EvaluationEvaluate(Object evaluation, ICandidate candidate)
 {
     IEvaluation eval = evaluation as IEvaluation;
     if (eval != null)
     {
         eval.Evaluate(candidate);
     }
     else
     {
         // use starting _ for PascalCase conversion purposes
         EvaluationDelegate _ed = evaluation as EvaluationDelegate;
         if (_ed != null)
         {
             _ed(candidate);
         }
     }
 }
        public void Evaluate(ICandidate candidate)
        {
			// use starting _ for PascalCase conversion purposes
            EvaluationDelegate _evaluation = GetEvaluationDelegate();
            _evaluation(candidate);
        }
Exemplo n.º 58
0
 public void Evaluate(ICandidate candidate)
 {
     Pilot pilot = (Pilot)candidate.GetObject();
     candidate.Include(pilot.Age % 2 != 0);
 }
Exemplo n.º 59
0
			public void Evaluate(ICandidate candidate)
			{
				Db4objects.Db4o.Tests.Common.Soda.Wrapper.Untyped.STShortWUTestCase sts = (Db4objects.Db4o.Tests.Common.Soda.Wrapper.Untyped.STShortWUTestCase
					)candidate.GetObject();
				candidate.Include((((short)sts.i_short) + 2) > 100);
			}
Exemplo n.º 60
0
			public void Evaluate(ICandidate candidate)
			{
				Db4objects.Db4o.Tests.Common.Soda.Classes.Simple.STStringTestCase sts = (Db4objects.Db4o.Tests.Common.Soda.Classes.Simple.STStringTestCase
					)candidate.GetObject();
				candidate.Include(sts.str.ToLower().IndexOf("od") >= 0);
			}