public void ShouldInsertARecord()
 {
     helper.CountDocuments.Should().Be(0);
     helper.Index(new ElasticArchiveRecord {
         ArchiveRecordId = "100"
     });
     helper.CountDocuments.Should().Be(1);
 }
        public void OneTimeSetup()
        {
            var uri  = "(change here, but do not commit)";
            var node = new Uri(uri);

            helper = new ElasticIndexHelper(node, "test2");
            if (helper.IndexExists("test2"))
            {
                helper.DeleteIndex("test2");
            }

            helper.CreateIndex("test2");

            var ear = new ElasticArchiveRecord();

            ear.ArchiveRecordId = "1";
            ear.PrimaryData     = new List <ElasticArchiveRecordPackage>();

            ear.PrimaryData.Add(new ElasticArchiveRecordPackage());
            ear.PrimaryData[0].Items.Add(new ElasticRepositoryObject());
            ear.PrimaryData[0].Items[0].Content = "PrimaryDataContent";

            ear.Title        = "Title";
            ear.WithinInfo   = "WithinInfo";
            ear.CustomFields = new
            {
                zugänglichkeitGemässBga = "In Schutzfrist",
                publikationsrechte      = "ABC"
            };

            helper.Index(ear);

            // Wait till index is ready
            ISearchResponse <ElasticArchiveRecord> searchResponse;

            do
            {
                Thread.Sleep(500);
                searchResponse = Search("Title", "title");
            } while (searchResponse.Hits.Count == 0);
        }