Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldStartWithSetsInitializedAndEmpty()
        public virtual void ShouldStartWithSetsInitializedAndEmpty()
        {
            // GIVEN
            RecordChangeSet changeSet = new RecordChangeSet(mock(typeof(Loaders)));

            // WHEN
            // nothing really

            // THEN
            assertEquals(0, changeSet.NodeRecords.changeSize());
            assertEquals(0, changeSet.PropertyRecords.changeSize());
            assertEquals(0, changeSet.RelRecords.changeSize());
            assertEquals(0, changeSet.SchemaRuleChanges.changeSize());
            assertEquals(0, changeSet.RelGroupRecords.changeSize());
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldClearStateOnClose()
        public virtual void ShouldClearStateOnClose()
        {
            // GIVEN
            NeoStores mockStore = mock(typeof(NeoStores));
            NodeStore store     = mock(typeof(NodeStore));

            when(mockStore.NodeStore).thenReturn(store);
            RelationshipStore relationshipStore = mock(typeof(RelationshipStore));

            when(mockStore.RelationshipStore).thenReturn(relationshipStore);
            PropertyStore propertyStore = mock(typeof(PropertyStore));

            when(mockStore.PropertyStore).thenReturn(propertyStore);
            SchemaStore schemaStore = mock(typeof(SchemaStore));

            when(mockStore.SchemaStore).thenReturn(schemaStore);
            RelationshipGroupStore groupStore = mock(typeof(RelationshipGroupStore));

            when(mockStore.RelationshipGroupStore).thenReturn(groupStore);

            RecordChangeSet changeSet = new RecordChangeSet(new Loaders(mockStore));

            // WHEN

            /*
             * We need to make sure some stuff is stored in the sets being managed. That is why forChangingLinkage() is
             * called - otherwise, no changes will be stored and changeSize() would return 0 anyway.
             */
            changeSet.NodeRecords.create(1L, null).forChangingLinkage();
            changeSet.PropertyRecords.create(1L, null).forChangingLinkage();
            changeSet.RelRecords.create(1L, null).forChangingLinkage();
            changeSet.SchemaRuleChanges.create(1L, null).forChangingLinkage();
            changeSet.RelGroupRecords.create(1L, 1).forChangingLinkage();

            changeSet.Close();

            // THEN
            assertEquals(0, changeSet.NodeRecords.changeSize());
            assertEquals(0, changeSet.PropertyRecords.changeSize());
            assertEquals(0, changeSet.RelRecords.changeSize());
            assertEquals(0, changeSet.SchemaRuleChanges.changeSize());
            assertEquals(0, changeSet.RelGroupRecords.changeSize());
        }