Ejemplo n.º 1
0
        public void TargetOnEntityTypeReturnsCorrectTopSupportedValue(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
            TopSupported top    = new TopSupported();
            bool         result = top.Load(model, calendar);

            // Assert
            Assert.True(result);
            Assert.False(top.IsSupported);
            Assert.NotNull(top.Supported);
            Assert.False(top.Supported.Value);
        }
Ejemplo n.º 2
0
        public void TargetOnEntitySetReturnsCorrectTopSupportedValue(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
            TopSupported top    = new TopSupported();
            bool         result = top.Load(model, calendars);

            // Assert
            Assert.True(result);
            Assert.False(top.IsSupported);
            Assert.NotNull(top.Supported);
            Assert.False(top.Supported.Value);
        }
Ejemplo n.º 3
0
        public void UnknownAnnotatableTargetReturnsDefaultTopSupportedValues()
        {
            // Arrange
            TopSupported  top        = new TopSupported();
            EdmEntityType entityType = new EdmEntityType("NS", "Entity");

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

            // Assert
            Assert.False(result);
            Assert.True(top.IsSupported);
            Assert.Null(top.Supported);
        }