private static Resume Resume(string firstnameLastname)
        {
            Assert.ValidInput(firstnameLastname, "firstname-lastname");

            firstnameLastname = firstnameLastname.Scrub();

            if (ServiceCache.IsInCache<Resume>(firstnameLastname))
            {
                var cachedResume = (Resume) ServiceCache.GetFromCache<Resume>(firstnameLastname);
                if (cachedResume != null)
                {
                    return cachedResume;
                }
            }

            var linkedInEmailAddress = ConfigurationManager.AppSettings["LinkedInEmailAddress"];
            var linkedInPassword = ConfigurationManager.AppSettings["LinkedInPassword"];

            var resumeSniffer = new LinkedInResumeSniffer(linkedInEmailAddress, linkedInPassword, firstnameLastname);

            Resume resume = null;
            try
            {
                resume = resumeSniffer.GetResume();
            }
            catch (Exception)
            {
                HandleErrors(linkedInEmailAddress);
            }

            HandleErrors(resumeSniffer.Errors);

            return resume.AddToCache(firstnameLastname);
        }
Exemple #2
0
        private static Resume Resume(string firstnameLastname)
        {
            Assert.ValidInput(firstnameLastname, "firstname-lastname");

            firstnameLastname = firstnameLastname.Scrub();

            if (ServiceCache.IsInCache <Resume>(firstnameLastname))
            {
                var cachedResume = (Resume)ServiceCache.GetFromCache <Resume>(firstnameLastname);
                if (cachedResume != null)
                {
                    return(cachedResume);
                }
            }

            var linkedInEmailAddress = ConfigurationManager.AppSettings["LinkedInEmailAddress"];
            var linkedInPassword     = ConfigurationManager.AppSettings["LinkedInPassword"];

            var resumeSniffer = new LinkedInResumeSniffer(linkedInEmailAddress, linkedInPassword, firstnameLastname);

            Resume resume = null;

            try
            {
                resume = resumeSniffer.GetResume();
            }
            catch (Exception)
            {
                HandleErrors(linkedInEmailAddress);
            }

            HandleErrors(resumeSniffer.Errors);

            return(resume.AddToCache(firstnameLastname));
        }
        public void ShouldGetResumeFromPageSource6()
        {
            var resumeSniffer = new LinkedInResumeSniffer("Adam Kahtava", TestHelper.PageSource6);

            var resume = resumeSniffer.GetResume();

            Assert.IsNotNull(resume);

            Assert.IsTrue(resume.Educations.Count == 2, resume.Educations.Count.ToString());
            Assert.IsFalse(string.IsNullOrEmpty(resume.Educations[0].Certificate));
            Assert.IsFalse(string.IsNullOrEmpty(resume.Educations[0].Institute));
            Assert.IsFalse(string.IsNullOrEmpty(resume.Educations[0].Period));
            foreach (var item in resume.Educations)
            {
                Console.WriteLine(item.Certificate + " " + item.Institute + " " + item.Period);
            }
        }
        public void ShouldGetResumeFromPageSource5()
        {
            var resumeSniffer = new LinkedInResumeSniffer("Adam Kahtava", TestHelper.PageSource5);

            var resume = resumeSniffer.GetResume();

            Assert.IsNotNull(resume);

            Assert.IsTrue(resume.Positions.Count == 5, resume.Positions.Count.ToString());
            Assert.IsFalse(string.IsNullOrEmpty(resume.Positions[0].Company));
            Assert.IsFalse(string.IsNullOrEmpty(resume.Positions[0].Description));
            Assert.IsFalse(string.IsNullOrEmpty(resume.Positions[0].Period));
            Assert.IsFalse(string.IsNullOrEmpty(resume.Positions[0].Title));
            foreach (var item in resume.Positions)
            {
                Console.WriteLine(item.Period + " " + item.Company + " " + item.Title + " " + item.Description);
            }

            Assert.IsTrue(resume.Educations.Count == 1, resume.Educations.Count.ToString());
            Assert.IsFalse(string.IsNullOrEmpty(resume.Educations[0].Certificate));
            Assert.IsFalse(string.IsNullOrEmpty(resume.Educations[0].Institute));
            foreach (var item in resume.Educations)
            {
                Console.WriteLine(item.Certificate + " " + item.Institute);
            }

            Assert.IsTrue(string.IsNullOrEmpty(resume.Specialties));
            Console.WriteLine(resume.Specialties);

            Assert.IsTrue(string.IsNullOrEmpty(resume.Summary));
            Console.WriteLine(resume.Summary);
        }
 public void TestSetup()
 {
     resumeSnifferWithStaticPageSource = new LinkedInResumeSniffer("Adam Kahtava", TestHelper.PageSource1);
 }
 public void ShouldGetEducationPeriods()
 {
     var resumeSniffer = new LinkedInResumeSniffer("Adam Kahtava", TestHelper.PageSource6);
     var periods = resumeSniffer.GetEducationPeriods();
     Assert.IsFalse(periods == null);
     Assert.IsFalse(periods.Count < 0);
     foreach (var item in periods)
     {
         Console.WriteLine(item);
     }
 }