public void BuildIndex_nullHashtags_NullReferenceException()
 {
     var ls = new StudentWorksSearch.LuceneSearch.LuceneEngine();
     ls.BuildIndex(new FileToIndex
     {
         Id = 0,
         Authors = "test",
         Description = "test",
         Hashtags = null,
         Text = "test",
         Title = "test",
         Discipline = "test"
     });
 }
        public void BuildIndex_nullTitle_NullReferenceException()
        {
            var ls = new StudentWorksSearch.LuceneSearch.LuceneEngine();

            ls.BuildIndex(new FileToIndex
            {
                Id          = 0,
                Authors     = "test",
                Description = "test",
                Hashtags    = "test",
                Text        = "test",
                Title       = null,
                Discipline  = "test"
            });
        }
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                LuceneSearch.LuceneEngine le = new LuceneSearch.LuceneEngine();
               var engine = new FileEngine();

                if (txtboxName.Text != "" && cmbboxDis.SelectedIndex != -1 && btnFile.Content.ToString() != "Выбрать файл")
                {
                   var IndexMe= engine.AddFile(txtboxName.Text, cmbboxDis.SelectedIndex, txtboxAuth.Text, txtboxTags.Text, txtboxComment.Text);
                    le.BuildIndex(IndexMe);//index this file

                    this.Close();
                }
                else
                    MessageBox.Show("Вы ввели не все данные!", "Ошибка!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        public void BuildIndex_objectPassed_NumberOfDocsIncreased()
        {
            //1
            var ls   = new StudentWorksSearch.LuceneSearch.LuceneEngine();
            var file = new FileToIndex
            {
                Id          = 0,
                Authors     = "test",
                Description = "test",
                Hashtags    = "test",
                Text        = "test",
                Title       = null,
                Discipline  = "test"
            };
            var was = ls.CountDocs();

            //2
            ls.BuildIndex(file);
            var now = ls.CountDocs();

            //3
            Assert.AreEqual(was + 1, now);
        }
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                LuceneSearch.LuceneEngine le = new LuceneSearch.LuceneEngine();
                var engine = new FileEngine();

                if (txtboxName.Text != "" && cmbboxDis.SelectedIndex != -1 && btnFile.Content.ToString() != "Выбрать файл")
                {
                    var IndexMe = engine.AddFile(txtboxName.Text, cmbboxDis.SelectedIndex, txtboxAuth.Text, txtboxTags.Text, txtboxComment.Text);
                    le.BuildIndex(IndexMe);//index this file

                    this.Close();
                }
                else
                {
                    MessageBox.Show("Вы ввели не все данные!", "Ошибка!", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
 public void BuildIndex_nullObject_NullReferenceException()
 {
     var ls = new StudentWorksSearch.LuceneSearch.LuceneEngine();
     ls.BuildIndex(new StudentWorksSearch.LuceneSearch.FileToIndex());
 }
        public void BuildIndex_objectPassed_NumberOfDocsIncreased()
        {
            //1
            var ls = new StudentWorksSearch.LuceneSearch.LuceneEngine();
            var file= new FileToIndex
            {
                Id = 0,
                Authors = "test",
                Description = "test",
                Hashtags = "test",
                Text = "test",
                Title = null,
                Discipline = "test"
            };
            var was = ls.CountDocs();

            //2
            ls.BuildIndex(file);
            var now = ls.CountDocs();

            //3
            Assert.AreEqual(was+1,now);
        }
        public void BuildIndex_nullObject_NullReferenceException()
        {
            var ls = new StudentWorksSearch.LuceneSearch.LuceneEngine();

            ls.BuildIndex(new StudentWorksSearch.LuceneSearch.FileToIndex());
        }