コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCreateGeneralIndex()
        public virtual void ShouldCreateGeneralIndex()
        {
            // GIVEN
            IndexDescriptor      descriptor = ForLabel(LABEL_ID, PROPERTY_ID_1);
            StoreIndexDescriptor indexRule  = descriptor.WithId(RULE_ID);

            // THEN
            assertThat(indexRule.Id, equalTo(RULE_ID));
            assertFalse(indexRule.CanSupportUniqueConstraint());
            assertThat(indexRule.Schema(), equalTo(descriptor.Schema()));
            assertThat(indexRule, equalTo(descriptor));
            assertThat(indexRule.ProviderDescriptor(), equalTo(ProviderDescriptor));
            assertException(indexRule.getOwningConstraint, typeof(System.InvalidOperationException));
            assertException(() => indexRule.WithOwningConstraint(RULE_ID_2), typeof(System.InvalidOperationException));
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCreateUniqueIndex()
        public virtual void ShouldCreateUniqueIndex()
        {
            // GIVEN
            IndexDescriptor      descriptor = UniqueForLabel(LABEL_ID, PROPERTY_ID_1);
            StoreIndexDescriptor indexRule  = descriptor.WithId(RULE_ID);

            // THEN
            assertThat(indexRule.Id, equalTo(RULE_ID));
            assertTrue(indexRule.CanSupportUniqueConstraint());
            assertThat(indexRule.Schema(), equalTo(descriptor.Schema()));
            assertThat(indexRule, equalTo(descriptor));
            assertThat(indexRule.ProviderDescriptor(), equalTo(ProviderDescriptor));
            assertThat(indexRule.OwningConstraint, equalTo(null));

            StoreIndexDescriptor withConstraint = indexRule.WithOwningConstraint(RULE_ID_2);

            assertThat(withConstraint.OwningConstraint, equalTo(RULE_ID_2));
            assertThat(indexRule.OwningConstraint, equalTo(null));                   // this is unchanged
        }