//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAddLabels() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldAddLabels()
        {
            // GIVEN
            ControlledInserter inserter = new ControlledInserter();

            long[] expected = new long[NODE_COUNT];
            using (NativeLabelScanWriter writer = new NativeLabelScanWriter(max(5, NODE_COUNT / 100), NativeLabelScanWriter.EMPTY))
            {
                writer.Initialize(inserter);

                // WHEN
                for (int i = 0; i < NODE_COUNT * 3; i++)
                {
                    NodeLabelUpdate update = RandomUpdate(expected);
                    writer.Write(update);
                }
            }

            // THEN
            for (int i = 0; i < LABEL_COUNT; i++)
            {
                long[] expectedNodeIds = nodesWithLabel(expected, i);
                long[] actualNodeIds   = asArray(new LabelScanValueIterator(inserter.NodesFor(i), new List <RawCursor <Hit <LabelScanKey, LabelScanValue>, IOException> >(), NO_ID));
                assertArrayEquals("For label " + i, expectedNodeIds, actualNodeIds);
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotAcceptUnsortedLabels() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotAcceptUnsortedLabels()
        {
            // GIVEN
            ControlledInserter inserter = new ControlledInserter();
            bool failed = false;

            try
            {
                using (NativeLabelScanWriter writer = new NativeLabelScanWriter(1, NativeLabelScanWriter.EMPTY))
                {
                    writer.Initialize(inserter);

                    // WHEN
                    writer.Write(NodeLabelUpdate.labelChanges(0, EMPTY_LONG_ARRAY, new long[] { 2, 1 }));
                    // we can't do the usual "fail( blabla )" here since the actual write will happen
                    // when closing this writer, i.e. in the curly bracket below.
                }
            }
            catch (System.ArgumentException e)
            {
                // THEN
                assertTrue(e.Message.contains("unsorted"));
                failed = true;
            }

            assertTrue(failed);
        }
 public RawCursorAnonymousInnerClass(ControlledInserter outerInstance, KeyValuePair <LabelScanKey, LabelScanValue>[] entries)
 {
     this.outerInstance = outerInstance;
     this._entries      = entries;
     arrayIndex         = -1;
 }