コード例 #1
0
        public void EnsureFunctionImportFunctionPropertyIsUnresolvedFunction()
        {
            var functionImport = new CsdlFunctionImport("GetStuff", "FQ.NS.GetStuff", null /*entitySet*/, true /*includeInServiceDocument*/, null /*documentation*/, testLocation);
            var csdlEntityContainer = CsdlBuilder.EntityContainer("Container", operationImports: new CsdlOperationImport[] {functionImport});
            var schema = CsdlBuilder.Schema("FQ.NS", csdlEntityContainers: new CsdlEntityContainer[] { csdlEntityContainer });
            var csdlModel = new CsdlModel();
            csdlModel.AddSchema(schema);
            
            var semanticSchema = new CsdlSemanticsSchema(new CsdlSemanticsModel(csdlModel, new EdmDirectValueAnnotationsManager(), Enumerable.Empty<IEdmModel>()), schema);

            CsdlSemanticsEntityContainer container = new CsdlSemanticsEntityContainer(semanticSchema, csdlEntityContainer);
            var imports = container.OperationImports().ToList();
            imports.Should().HaveCount(1);
            var csdlFunctionImport = (IEdmFunctionImport)imports[0];
            csdlFunctionImport.Name.Should().Be("GetStuff");
            csdlFunctionImport.Operation.GetType().Should().Be(typeof(UnresolvedFunction));
            var errors = csdlFunctionImport.Operation.As<BadElement>().Errors.ToList();
            errors.Should().HaveCount(1);
            errors.First().ErrorMessage.Should().Be(Strings.Bad_UnresolvedOperation("FQ.NS.GetStuff"));
            csdlFunctionImport.Container.Name.Should().Be("Container");
            csdlFunctionImport.Location().Should().Be(testLocation);
            csdlFunctionImport.ContainerElementKind.Should().Be(EdmContainerElementKind.FunctionImport);
            csdlFunctionImport.EntitySet.Should().BeNull();
            csdlFunctionImport.IncludeInServiceDocument.Should().BeTrue();
            csdlFunctionImport.Function.IsComposable.Should().BeFalse();
        }
コード例 #2
0
        public void CsdlSemanticsFunctionImportPropertiesShouldBeInitializedCorrectly()
        {
            // Added to ensure this is filtered out
            var function = CsdlBuilder.Function("GetStuff");
            
            var functionImport = new CsdlFunctionImport("GetStuff", "FQ.NS.GetStuff", null /*entitySet*/, true /*includeInServiceDocument*/, null /*documentation*/, testLocation);
            var csdlEntityContainer = CsdlBuilder.EntityContainer("Container");

            var semanticSchema = CreateCsdlSemanticsSchema(csdlEntityContainer, function);
            var semanticFunction = new CsdlSemanticsFunction(semanticSchema, function);

            var csdlSemanticEntityContainer = new CsdlSemanticsEntityContainer(semanticSchema, csdlEntityContainer);
            var semanticActionImport = new CsdlSemanticsFunctionImport(csdlSemanticEntityContainer, functionImport, semanticFunction);
            semanticActionImport.Function.Should().NotBeNull();
            semanticActionImport.Function.Name.Should().Be("GetStuff");
            semanticActionImport.Container.Name.Should().Be("Container");
            semanticActionImport.Location().Should().Be(testLocation);
            semanticActionImport.ContainerElementKind.Should().Be(EdmContainerElementKind.FunctionImport);
            semanticActionImport.EntitySet.Should().BeNull();
            semanticActionImport.IncludeInServiceDocument.Should().BeTrue();
        }
コード例 #3
0
 public CsdlSemanticsFunctionImport(CsdlSemanticsEntityContainer container, CsdlFunctionImport functionImport, IEdmFunction backingfunction)
     : base(container, functionImport, backingfunction)
 {
     this.csdlSchema = container.Context;
     this.functionImport = functionImport;
 }