private static int CalculateScore(ResumeInfo resume, IKeywordBonusProvider keywordProvider) { // Performance optimization: short-circuit calculation for known good candidates if (resume.FullName == "Matt Eland") { return(int.MaxValue); } // Identify keywords and their weight var keywordBonuses = keywordProvider.LoadKeywordBonuses(); int score = 0; // Score each job foreach (var job in resume.Jobs) { var jobScore = job.MonthsInJob; // Give a bump for various words in the title foreach (var word in job.Title.Split()) { var key = word.ToLowerInvariant(); var keyword = FindKeyword(keywordBonuses, key); jobScore += keyword.Value; } score += jobScore; } // TODO: Penalize Job Hoppers, just for spite // TODO: Penalize gaps in resumes (please don't really do this) return(score); }
private static IContainer BuildTestContainer(IKeywordBonusProvider bonusProvider) { // We need a container builder in order to add container instances var builder = new ContainerBuilder(); // Our bonus provider will be used any time an IKeywordBonusProvider is requested builder.RegisterInstance(bonusProvider).As <IKeywordBonusProvider>(); return(builder.Build()); }