public void TargetOnEntitySetReturnsCorrectSkipSupportedValue(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 SkipSupported skip = new SkipSupported(); bool result = skip.Load(model, calendars); // Assert Assert.True(result); Assert.NotNull(skip.Supported); Assert.False(skip.Supported.Value); }
public void TargetOnEntityTypeReturnsCorrectSkipSupportedValue(EdmVocabularyAnnotationSerializationLocation location) { // Arrange const string template = @" <Annotations Target=""NS.Calendar""> {0} </Annotations>"; IEdmModel model = GetEdmModel(template, location); Assert.NotNull(model); // guard IEdmEntityType calendar = model.SchemaElements.OfType <IEdmEntityType>().First(c => c.Name == "Calendar"); Assert.NotNull(calendar); // guard // Act SkipSupported skip = new SkipSupported(); bool result = skip.Load(model, calendar); // Assert Assert.True(result); Assert.False(skip.IsSupported); Assert.NotNull(skip.Supported); Assert.False(skip.Supported.Value); }
public void KindPropertyReturnsSkipSupportedEnumMember() { // Arrange & Act SkipSupported skip = new SkipSupported(); // Assert Assert.Equal(CapabilitesTermKind.SkipSupported, skip.Kind); }
public void UnknownAnnotatableTargetReturnsDefaultSkipSupportedValues() { // Arrange SkipSupported skip = new SkipSupported(); EdmEntityType entityType = new EdmEntityType("NS", "Entity"); // Act bool result = skip.Load(EdmCoreModel.Instance, entityType); // Assert Assert.False(result); Assert.True(skip.IsSupported); Assert.Null(skip.Supported); }
/// <summary> /// Create the $skip parameter. /// </summary> /// <param name="context">The OData context.</param> /// <param name="target">The Edm annotation target.</param> /// <returns>The created <see cref="OpenApiParameter"/> or null.</returns> public static OpenApiParameter CreateSkip(this ODataContext context, IEdmVocabularyAnnotatable target) { Utils.CheckArgumentNull(context, nameof(context)); Utils.CheckArgumentNull(target, nameof(target)); SkipSupported skip = context.Model.GetSkipSupported(target); if (skip == null || skip.IsSupported) { return(new OpenApiParameter { Reference = new OpenApiReference { Type = ReferenceType.Parameter, Id = "skip" } }); } return(null); }