Example #1
0
        public void CreateIndexTest()
        {
            var indexer = new QuestionIndexer();
            var res     = indexer.CreateIndex();

            Assert.True(res);
        }
Example #2
0
        void IndexAllQuestions()
        {
            var ctx     = new ApplicationDbContext();
            var repo    = new QuestionRepository(ctx);
            var catRepo = new QuestionCategoryRepository(ctx);
            var all     = repo.FindAllOrDefault(x => x.IsApproved == true).ToList();
            var catDesc = catRepo.GetAll().ToDictionary(x => x.Id, x => x.Name);

            all.ForEach(x => x.CategoryDescription = catDesc.GetValueOrDefault(x.CategoryId, "General"));

            var indexer = new QuestionIndexer();

            indexer.IndexData(all);
        }
Example #3
0
        public void IndexDataTest()
        {
            var indexer = new QuestionIndexer();
            var q1      = new Question();

            q1.Id = 23;
            q1.CategoryDescription = "General";
            q1.Title       = "how to register to vote";
            q1.Description = "I really would like to go to vote this summer, can someone explain to me how/where to register, I have no idea.";

            var res = indexer.IndexData(q1);

            Assert.True(res);
        }
Example #4
0
        public void IndexBulkDataTest()
        {
            var indexer = new QuestionIndexer();
            var q1      = new Question();
            var q2      = new Question();

            q1.Id          = 3;
            q2.Id          = 4;
            q1.Title       = "how to register to vote";
            q2.Title       = "how to lose weight";
            q1.Description = "I realy would like to go to vote this summer, can someone explain to me how/where to register, I have no idea.";
            q2.Description = "I'm 150 kg, i would like to get into shape as fast as possible, what is the best way?";
            var list = new List <Question>();

            list.Add(q1);
            list.Add(q2);
            var res = indexer.IndexData(list);

            Assert.True(res);
        }
Example #5
0
        public void Bela()
        {
            var indexer = new QuestionIndexer();

            indexer.bela();
        }