public void Index_returns_same_instance_for_clr_properties() { var entityType = new Model().AddEntityType(typeof(Order)); var entityBuilder = new InternalEntityBuilder(entityType, new InternalModelBuilder(new Model(), null)); var indexBuilder = entityBuilder.Index(new[] { Order.IdProperty, Order.CustomerIdProperty }, ConfigurationSource.Explicit); Assert.NotNull(indexBuilder); Assert.Same(indexBuilder, entityBuilder.Index(new[] { Order.IdProperty.Name, Order.CustomerIdProperty.Name }, ConfigurationSource.DataAnnotation)); }
public void Index_returns_null_for_ignored_property_names() { var entityType = new Model().AddEntityType(typeof(Order)); var entityBuilder = new InternalEntityBuilder(entityType, new InternalModelBuilder(new Model(), null)); entityBuilder.Ignore(Order.CustomerIdProperty.Name, ConfigurationSource.DataAnnotation); Assert.Null(entityBuilder.Index(new[] { Order.IdProperty.Name, Order.CustomerIdProperty.Name }, ConfigurationSource.Convention)); }
public void Cannot_ignore_property_that_is_part_of_same_or_higher_source_index() { var entityType = new Model().AddEntityType(typeof(Order)); var entityBuilder = new InternalEntityBuilder(entityType, new InternalModelBuilder(new Model(), null)); Assert.NotNull(entityBuilder.Index(new[] { Order.IdProperty, Order.CustomerIdProperty }, ConfigurationSource.Explicit)); Assert.False(entityBuilder.Ignore(Order.CustomerIdProperty.Name, ConfigurationSource.DataAnnotation)); Assert.NotEmpty(entityBuilder.Metadata.Properties.Where(p => p.Name == Order.CustomerIdProperty.Name)); Assert.NotEmpty(entityBuilder.Metadata.Indexes); }