Example #1
0
        public Celebrity Find(string name)
        {
            var context = new CelebFinderContext {Name = name};
            var workers = new ICelebFinderContributor[]
            {
                new DbFinder(_celebrityRepository),
                new WikipediaPageFinder(),
                new ResourceTypeValidator(new DbpediaTypesRepository())
            };

            foreach (var worker in workers)
            {
                worker.Execute(context);

                if(context.Celebrity != null)
                    break;
            }

            return context.Celebrity;
        }
Example #2
0
 protected static void Tried_to_find_celebrity_in_the_db(string name)
 {
     var celebFinderContext = new CelebFinderContext {Name = name};
     new DbFinder(CelebrityRepository.Object).Execute(celebFinderContext);
     Celebrity = celebFinderContext.Celebrity;
 }
 public WikipediaPageFinderContext()
 {
     _context = new CelebFinderContext();
 }