public void TargetOnEntitySetReturnsCorrectIndexableByKeyValue(EdmVocabularyAnnotationSerializationLocation location) { // Arrange const string template = @" <Annotations Target=""NS.Default/Calendars""> {0} </Annotations>"; IEdmModel model = GetEdmModel(template, location); Assert.NotNull(model); // guard IEdmEntitySet calendars = model.EntityContainer.FindEntitySet("Calendars"); Assert.NotNull(calendars); // guard // Act IndexableByKey index = new IndexableByKey(); bool result = index.Load(model, calendars); // Assert Assert.True(result); Assert.NotNull(index.Supported); Assert.False(index.Supported.Value); }
public void KindPropertyReturnsIndexableByKeyEnumMember() { // Arrange & Act IndexableByKey index = new IndexableByKey(); // Assert Assert.Equal(CapabilitesTermKind.IndexableByKey, index.Kind); }
public void UnknownAnnotatableTargetReturnsDefaultIndexableByKeyValues() { // Arrange IndexableByKey index = new IndexableByKey(); EdmEntityType entityType = new EdmEntityType("NS", "Entity"); // Act bool result = index.Load(EdmCoreModel.Instance, entityType); // Assert Assert.False(result); Assert.True(index.IsSupported); Assert.Null(index.Supported); }
/// <inheritdoc/> protected override void SetOperations(OpenApiPathItem item) { IndexableByKey index = Context.Model.GetIndexableByKey(EntitySet); if (index == null || index.IsSupported) { AddOperation(item, OperationType.Get); } UpdateRestrictions update = Context.Model.GetUpdateRestrictions(EntitySet); if (update == null || update.IsUpdatable) { AddOperation(item, OperationType.Patch); } DeleteRestrictions delete = Context.Model.GetDeleteRestrictions(EntitySet); if (delete == null || delete.IsDeletable) { AddOperation(item, OperationType.Delete); } }