Esempio n. 1
0
        public void BoundCsdlSemanticsOperationPropertiesShouldBeCorrect()
        {
            var action = new CsdlAction(
                "Checkout",
                new CsdlOperationParameter[] { new CsdlOperationParameter("entity", new CsdlNamedTypeReference("FQ.NS.EntityType", false, testLocation), testLocation) },
                new CsdlOperationReturn(new CsdlNamedTypeReference("Edm.String", false, testLocation), testLocation),
                true /*isBound*/,
                "entity/FakePath",
                testLocation);

            var semanticAction = new CsdlSemanticsAction(this.semanticSchema, action);

            semanticAction.IsBound.Should().BeTrue();
            semanticAction.Location().Should().Be(testLocation);
            semanticAction.Name.Should().Be("Checkout");
            semanticAction.Namespace.Should().Be("FQ.NS");
            semanticAction.ReturnType.Definition.Should().Be(EdmCoreModel.Instance.GetString(true).Definition);
            semanticAction.EntitySetPath.PathSegments.ToList()[0].Should().Be("entity");
            semanticAction.EntitySetPath.PathSegments.ToList()[1].Should().Be("FakePath");
            semanticAction.SchemaElementKind.Should().Be(EdmSchemaElementKind.Action);
        }
        public void BoundCsdlSemanticsOperationPropertiesShouldBeCorrect()
        {
            var action = new CsdlAction(
                "Checkout",
                new CsdlOperationParameter[] { new CsdlOperationParameter("entity", new CsdlNamedTypeReference("FQ.NS.EntityType", false, testLocation), testLocation) },
                new CsdlOperationReturn(new CsdlNamedTypeReference("Edm.String", false, testLocation), testLocation),
                true /*isBound*/,
                "entity/FakePath",
                testLocation);

            var semanticAction = new CsdlSemanticsAction(this.semanticSchema, action);

            Assert.True(semanticAction.IsBound);
            Assert.Equal(testLocation, semanticAction.Location());
            Assert.Equal("Checkout", semanticAction.Name);
            Assert.Equal("FQ.NS", semanticAction.Namespace);
            Assert.Equal("Edm.String", semanticAction.ReturnType.Definition.FullTypeName());
            Assert.Equal("entity", semanticAction.EntitySetPath.PathSegments.ToList()[0]);
            Assert.Equal("FakePath", semanticAction.EntitySetPath.PathSegments.ToList()[1]);
            Assert.Equal(EdmSchemaElementKind.Action, semanticAction.SchemaElementKind);
        }