//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReturnAllNodesWithLabel()
        public virtual void ShouldReturnAllNodesWithLabel()
        {
            // GIVEN
            Node node1    = CreateLabeledNode(Db, map("name", "First", "age", 1L), Label1);
            Node node2    = CreateLabeledNode(Db, map("type", "Node", "count", 10), Label1, Label2);
            int  labelId1 = LabelId(Label1);
            int  labelId2 = LabelId(Label2);

            // WHEN
            LongIterator nodesForLabel1 = StorageReader.nodesGetForLabel(labelId1);
            LongIterator nodesForLabel2 = StorageReader.nodesGetForLabel(labelId2);

            // THEN
            assertEquals(asSet(node1.Id, node2.Id), PrimitiveLongCollections.toSet(nodesForLabel1));
            assertEquals(asSet(node2.Id), PrimitiveLongCollections.toSet(nodesForLabel2));
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldProvidePopulatorThatAcceptsDuplicateEntries() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
            public virtual void ShouldProvidePopulatorThatAcceptsDuplicateEntries()
            {
                // when
                IndexSamplingConfig indexSamplingConfig = new IndexSamplingConfig(Config.defaults());

                WithPopulator(IndexProvider.getPopulator(Descriptor, indexSamplingConfig, heapBufferFactory(1024)), p => p.add(Arrays.asList(add(1, Descriptor.schema(), "v1", "v2"), add(2, Descriptor.schema(), "v1", "v2"))));

                // then
                using (IndexAccessor accessor = IndexProvider.getOnlineAccessor(Descriptor, indexSamplingConfig))
                {
                    using (IndexReader reader = new QueryResultComparingIndexReader(accessor.NewReader()))
                    {
                        LongIterator nodes = reader.Query(IndexQuery.exact(1, "v1"), IndexQuery.exact(1, "v2"));
                        assertEquals(asSet(1L, 2L), PrimitiveLongCollections.toSet(nodes));
                    }
                }
            }