Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void deletingNodeWithRelationshipsIsNotAllowed()
		 public virtual void DeletingNodeWithRelationshipsIsNotAllowed()
		 {
			  // Given
			  NeoStores store = mock( typeof( NeoStores ) );
			  IndexingService indexes = mock( typeof( IndexingService ) );
			  IntegrityValidator validator = new IntegrityValidator( store, indexes );

			  NodeRecord record = new NodeRecord( 1L, false, 1L, -1L );
			  record.InUse = false;

			  // When
			  try
			  {
					validator.ValidateNodeRecord( record );
					fail( "Should have thrown integrity error." );
			  }
			  catch ( Exception )
			  {
					// good
			  }
		 }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void transactionsStartedBeforeAConstraintWasCreatedAreDisallowed()
		 public virtual void TransactionsStartedBeforeAConstraintWasCreatedAreDisallowed()
		 {
			  // Given
			  NeoStores store = mock( typeof( NeoStores ) );
			  MetaDataStore metaDataStore = mock( typeof( MetaDataStore ) );
			  when( store.MetaDataStore ).thenReturn( metaDataStore );
			  IndexingService indexes = mock( typeof( IndexingService ) );
			  when( metaDataStore.LatestConstraintIntroducingTx ).thenReturn( 10L );
			  IntegrityValidator validator = new IntegrityValidator( store, indexes );

			  // When
			  try
			  {
					validator.ValidateTransactionStartKnowledge( 1 );
					fail( "Should have thrown integrity error." );
			  }
			  catch ( Exception )
			  {
					// good
			  }
		 }
Exemple #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldValidateUniquenessIndexes() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
		 public virtual void ShouldValidateUniquenessIndexes()
		 {
			  // Given
			  NeoStores store = mock( typeof( NeoStores ) );
			  IndexingService indexes = mock( typeof( IndexingService ) );
			  IntegrityValidator validator = new IntegrityValidator( store, indexes );
			  UniquenessConstraintDescriptor constraint = ConstraintDescriptorFactory.uniqueForLabel( 1, 1 );

			  doThrow( new UniquePropertyValueValidationException( constraint, ConstraintValidationException.Phase.VERIFICATION, new Exception() ) ).when(indexes).validateIndex(2L);

			  ConstraintRule record = ConstraintRule.constraintRule( 1L, constraint, 2L );

			  // When
			  try
			  {
					validator.ValidateSchemaRule( record );
					fail( "Should have thrown integrity error." );
			  }
			  catch ( Exception )
			  {
					// good
			  }
		 }