public void Can_add_retrieve_and_remove_indexes() { var entityType = new EntityType(typeof(Order)); var property1 = entityType.AddProperty(Order.IdProperty); var property2 = entityType.AddProperty(Order.CustomerIdProperty); Assert.Equal(0, entityType.Indexes.Count); var index1 = entityType.AddIndex(property1); Assert.Equal(1, index1.Properties.Count); Assert.Same(property1, index1.Properties[0]); var index2 = entityType.AddIndex(property1, property2); Assert.Equal(2, index2.Properties.Count); Assert.Same(property1, index2.Properties[0]); Assert.Same(property2, index2.Properties[1]); Assert.Equal(2, entityType.Indexes.Count); Assert.Same(index1, entityType.Indexes[0]); Assert.Same(index2, entityType.Indexes[1]); entityType.RemoveIndex(index1); Assert.Equal(1, entityType.Indexes.Count); Assert.Same(index2, entityType.Indexes[0]); entityType.RemoveIndex(index2); Assert.Equal(0, entityType.Indexes.Count); }
public void RemoveIndex_check_arguments() { var entityType = new EntityType(typeof(Order)); Assert.Equal( "index", // ReSharper disable once AssignNullToNotNullAttribute Assert.Throws <ArgumentNullException>(() => entityType.RemoveIndex(null)).ParamName); }