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 shouldListAllConstraints()
        public virtual void ShouldListAllConstraints()
        {
            // Given
            SchemaHelper.createUniquenessConstraint(Db, Label1, PropertyKey);
            SchemaHelper.createUniquenessConstraint(Db, Label2, PropertyKey);
            SchemaHelper.createNodeKeyConstraint(Db, Label1, OtherPropertyKey);
            SchemaHelper.createNodeKeyConstraint(Db, Label2, OtherPropertyKey);

            SchemaHelper.createNodePropertyExistenceConstraint(Db, Label2, PropertyKey);
            SchemaHelper.createRelPropertyExistenceConstraint(Db, RelType1, PropertyKey);

            SchemaHelper.awaitIndexes(Db);

            // When
            ISet <ConstraintDescriptor> constraints = asSet(StorageReader.constraintsGetAll());

            // Then
            int labelId1   = LabelId(Label1);
            int labelId2   = LabelId(Label2);
            int relTypeId  = RelationshipTypeId(RelType1);
            int propKeyId  = PropertyKeyId(PropertyKey);
            int propKeyId2 = PropertyKeyId(OtherPropertyKey);

            assertThat(constraints, containsInAnyOrder(ConstraintDescriptorFactory.uniqueForLabel(labelId1, propKeyId), ConstraintDescriptorFactory.uniqueForLabel(labelId2, propKeyId), ConstraintDescriptorFactory.nodeKeyForLabel(labelId1, propKeyId2), ConstraintDescriptorFactory.nodeKeyForLabel(labelId2, propKeyId2), ConstraintDescriptorFactory.existsForLabel(labelId2, propKeyId), ConstraintDescriptorFactory.existsForRelType(relTypeId, propKeyId)));
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldListAllConstraints()
        public virtual void ShouldListAllConstraints()
        {
            // Given
            CreateUniquenessConstraint(Label1, PropertyKey);
            CreateUniquenessConstraint(Label2, PropertyKey);

            // When
            ISet <ConstraintDescriptor> constraints = asSet(StorageReader.constraintsGetAll());

            // Then
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Set<?> expectedConstraints = asSet(uniqueConstraintDescriptor(label1, propertyKey), uniqueConstraintDescriptor(label2, propertyKey));
            ISet <object> expectedConstraints = asSet(UniqueConstraintDescriptor(Label1, PropertyKey), UniqueConstraintDescriptor(Label2, PropertyKey));

            assertEquals(expectedConstraints, constraints);
        }