public void KindPropertyReturnsDeleteRestrictionsEnumMember() { // Arrange & Act DeleteRestrictions delete = new DeleteRestrictions(); // Assert Assert.Equal(CapabilitesTermKind.DeleteRestrictions, delete.Kind); }
private static void VerifyDeleteRestrictions(DeleteRestrictions delete) { Assert.NotNull(delete); Assert.NotNull(delete.Deletable); Assert.False(delete.Deletable.Value); Assert.NotNull(delete.NonDeletableNavigationProperties); Assert.Equal(2, delete.NonDeletableNavigationProperties.Count); Assert.Equal("abc|RelatedEvents", String.Join("|", delete.NonDeletableNavigationProperties)); Assert.True(delete.IsNonDeletableNavigationProperty("RelatedEvents")); }
public void UnknownAnnotatableTargetReturnsDefaultDeleteRestrictionsValues() { // Arrange DeleteRestrictions delete = new DeleteRestrictions(); EdmEntityType entityType = new EdmEntityType("NS", "Entity"); // Act bool result = delete.Load(EdmCoreModel.Instance, entityType); // Assert Assert.False(result); Assert.True(delete.IsDeletable); Assert.Null(delete.Deletable); Assert.Null(delete.NonDeletableNavigationProperties); }
/// <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); } }
public void TargetOnEntitySetReturnsCorrectDeleteRestrictionsValue(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 DeleteRestrictions delete = new DeleteRestrictions(); bool result = delete.Load(model, calendars); // Assert Assert.True(result); VerifyDeleteRestrictions(delete); }