public void Can_create_unique_index_from_properties() { var entityType = new Model().AddEntityType(typeof(Customer)); var property1 = entityType.GetOrAddProperty(Customer.IdProperty); var property2 = entityType.GetOrAddProperty(Customer.NameProperty); var index = entityType.AddIndex(new[] { property1, property2 }); index.IsUnique = true; Assert.True(new[] { property1, property2 }.SequenceEqual(index.Properties)); Assert.True(index.IsUnique); }
public void Can_create_index_from_properties() { var entityType = new Model().AddEntityType(typeof(Customer)); var property1 = entityType.GetOrAddProperty(Customer.IdProperty); var property2 = entityType.GetOrAddProperty(Customer.NameProperty); var index = entityType.AddIndex(new[] { property1, property2 }, ConfigurationSource.Convention); Assert.True(new[] { property1, property2 }.SequenceEqual(index.Properties)); Assert.False(index.IsUnique); Assert.Equal(ConfigurationSource.Convention, index.GetConfigurationSource()); }