//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFailOnUnsortedLabelsFromFullStoreChangeStream() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldFailOnUnsortedLabelsFromFullStoreChangeStream()
        {
            // given
            PageCache pageCache = _pageCacheRule.getPageCache(_fileSystemRule.get());
            IList <NodeLabelUpdate> existingData = new List <NodeLabelUpdate>();

            existingData.Add(NodeLabelUpdate.labelChanges(1, new long[0], new long[] { 2, 1 }));
            FullStoreChangeStream changeStream         = asStream(existingData);
            NativeLabelScanStore  nativeLabelScanStore = null;

            try
            {
                nativeLabelScanStore = new NativeLabelScanStore(pageCache, _testDirectory.databaseLayout(), _fileSystemRule.get(), changeStream, false, new Monitors(), immediate());
                nativeLabelScanStore.Init();

                // when
                nativeLabelScanStore.Start();
                fail("Expected native label scan store to fail on ");
            }
            catch (System.ArgumentException e)
            {
                // then
                assertThat(e.Message, Matchers.containsString("unsorted label"));
                assertThat(e.Message, Matchers.stringContainsInOrder(Iterables.asIterable("2", "1")));
            }
            finally
            {
                if (nativeLabelScanStore != null)
                {
                    nativeLabelScanStore.Shutdown();
                }
            }
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void createDirtyIndex(org.neo4j.io.pagecache.PageCache pageCache) throws java.io.IOException
        private void CreateDirtyIndex(PageCache pageCache)
        {
            NativeLabelScanStore nativeLabelScanStore = null;

            try
            {
                nativeLabelScanStore = new NativeLabelScanStore(pageCache, _testDirectory.databaseLayout(), _fileSystemRule.get(), _throwingStream, false, new Monitors(), immediate());

                nativeLabelScanStore.Init();
                nativeLabelScanStore.Start();
            }
            catch (System.ArgumentException)
            {
                if (nativeLabelScanStore != null)
                {
                    nativeLabelScanStore.Shutdown();
                }
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void labelScanStoreIsDirtyWhenIndexIsNotClean() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void LabelScanStoreIsDirtyWhenIndexIsNotClean()
        {
            PageCache pageCache = _pageCacheRule.getPageCache(_fileSystemRule.get());

            CreateDirtyIndex(pageCache);

            Monitors         monitors = new Monitors();
            RecordingMonitor monitor  = new RecordingMonitor();

            monitors.AddMonitorListener(monitor);

            NativeLabelScanStore nativeLabelScanStore = new NativeLabelScanStore(pageCache, _testDirectory.databaseLayout(), _fileSystemRule.get(), EMPTY, true, monitors, ignore());

            nativeLabelScanStore.Init();
            nativeLabelScanStore.Start();

            assertTrue(nativeLabelScanStore.Dirty);
            nativeLabelScanStore.Shutdown();
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void doNotRebuildIfOpenedInReadOnlyModeAndIndexIsNotClean() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void DoNotRebuildIfOpenedInReadOnlyModeAndIndexIsNotClean()
        {
            PageCache pageCache = _pageCacheRule.getPageCache(_fileSystemRule.get());

            CreateDirtyIndex(pageCache);

            Monitors         monitors = new Monitors();
            RecordingMonitor monitor  = new RecordingMonitor();

            monitors.AddMonitorListener(monitor);

            NativeLabelScanStore nativeLabelScanStore = new NativeLabelScanStore(pageCache, _testDirectory.databaseLayout(), _fileSystemRule.get(), EMPTY, true, monitors, ignore());

            nativeLabelScanStore.Init();
            nativeLabelScanStore.Start();

            assertTrue(monitor.NotValid);
            assertFalse(monitor.RebuiltConflict);
            assertFalse(monitor.RebuildingConflict);
            nativeLabelScanStore.Shutdown();
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustBeDirtyIfFailedDuringRebuild() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MustBeDirtyIfFailedDuringRebuild()
        {
            // given
            PageCache pageCache = _pageCacheRule.getPageCache(_fileSystemRule.get());

            CreateDirtyIndex(pageCache);

            // when
            RecordingMonitor monitor  = new RecordingMonitor();
            Monitors         monitors = new Monitors();

            monitors.AddMonitorListener(monitor);

            NativeLabelScanStore nativeLabelScanStore = new NativeLabelScanStore(pageCache, _testDirectory.databaseLayout(), _fileSystemRule.get(), EMPTY, false, monitors, immediate());

            nativeLabelScanStore.Init();
            nativeLabelScanStore.Start();

            // then
            assertTrue(monitor.NotValid);
            assertTrue(monitor.RebuildingConflict);
            assertTrue(monitor.RebuiltConflict);
            nativeLabelScanStore.Shutdown();
        }