public void UnknownAnnotatableTargetReturnsDefaultSortRestrictionsValues()
        {
            // Arrange & Act
            SortRestrictions sort       = new SortRestrictions();
            EdmEntityType    entityType = new EdmEntityType("NS", "Entity");

            //  Act
            bool result = sort.Load(EdmCoreModel.Instance, entityType);

            // Assert
            Assert.False(result);
            Assert.True(sort.IsSortable);
            Assert.Null(sort.Sortable);
            Assert.Null(sort.AscendingOnlyProperties);
            Assert.Null(sort.DescendingOnlyProperties);
            Assert.Null(sort.NonSortableProperties);
        }
        public void TargetOnEntitySetReturnsCorrectSortRestrictionsValue(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
            SortRestrictions sort   = new SortRestrictions();
            bool             result = sort.Load(model, calendars);

            // Assert
            Assert.True(result);
            VerifySortRestrictions(sort);
        }
        public void TargetOnEntityTypeReturnsCorrectSortRestrictionsValue(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
            SortRestrictions sort   = new SortRestrictions();
            bool             result = sort.Load(model, calendar);

            // Assert
            Assert.True(result);
            VerifySortRestrictions(sort);
        }