Ejemplo n.º 1
0
//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);
            }
        }