Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotDropPropertyExistenceConstraintThatDoesNotExistWhenThereIsAUniquePropertyConstraint() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotDropPropertyExistenceConstraintThatDoesNotExistWhenThereIsAUniquePropertyConstraint()
        {
            // given
            ConstraintDescriptor constraint;

            {
                SchemaWrite statement = schemaWriteInNewTransaction();
                constraint = statement.UniquePropertyConstraintCreate(Descriptor);
                commit();
            }

            // when
            try
            {
                SchemaWrite statement = schemaWriteInNewTransaction();
                statement.ConstraintDrop(ConstraintDescriptorFactory.existsForSchema(constraint.Schema()));

                fail("expected exception");
            }
            // then
            catch (DropConstraintFailureException e)
            {
                assertThat(e.InnerException, instanceOf(typeof(NoSuchConstraintException)));
            }
            finally
            {
                rollback();
            }

            {
                // then
                Transaction transaction = newTransaction();

                IEnumerator <ConstraintDescriptor> constraints = transaction.SchemaRead().constraintsGetForSchema(Descriptor);

                assertEquals(constraint, single(constraints));
                commit();
            }
        }
Пример #2
0
 internal override NodeExistenceConstraintDescriptor NewConstraintObject(LabelSchemaDescriptor descriptor)
 {
     return(ConstraintDescriptorFactory.existsForSchema(descriptor));
 }
Пример #3
0
 internal override RelExistenceConstraintDescriptor NewConstraintObject(RelationTypeSchemaDescriptor descriptor)
 {
     return(ConstraintDescriptorFactory.existsForSchema(descriptor));
 }