Exemplo n.º 1
0
        public void NavigationPropertiesShouldHaveAssociatedTargetMultiplicity()
        {
            var semanticTree = ModelMaker.GetSemanticTree("People?$filter=MyDog/Color eq 'Magenta'", this.edmModel);

            semanticTree.Query.As <FilterQueryNode>().Expression.As <BinaryOperatorQueryNode>().Left.As
            <PropertyAccessQueryNode>().Source.As <SingletonNavigationNode>().TargetMultiplicity.Should().Be(EdmMultiplicity.ZeroOrOne);
        }
Exemplo n.º 2
0
        public void ComplexTypesShouldBeCastable()
        {
            var semanticTree = ModelMaker.GetSemanticTree("People?$filter=MyDog/MyPeople/any(a: a/MyAddress/MvcApplication3.Address/City eq 'Renton')", this.edmModel);

            var cmpAddress = this.edmModel.FindType("MvcApplication3.Address");

            semanticTree.Query.As <FilterQueryNode>().Expression.As <AnyQueryNode>().Body.As <BinaryOperatorQueryNode>().
            Left.As <PropertyAccessQueryNode>().Source.As <CastNode>().TypeReference.Definition.Should().Be(cmpAddress);
        }
Exemplo n.º 3
0
        public void ComplexTypeShouldCreateCorrectSemanticNode()
        {
            var semanticTree = ModelMaker.GetSemanticTree("People?$filter=MyAddress/City eq 'Tacoma'", this.edmModel);

            var cmpAddress = this.edmModel.FindType("MvcApplication3.Address");

            semanticTree.Query.As <FilterQueryNode>().Expression.As <BinaryOperatorQueryNode>().
            Left.As <PropertyAccessQueryNode>().Source.As <PropertyAccessQueryNode>().TypeReference.Definition.Should().Be(cmpAddress);
        }
Exemplo n.º 4
0
        public void NavigationPropertiesShouldCreateCorrectSemanticNode()
        {
            var semanticTree = ModelMaker.GetSemanticTree("People?$filter=MyDog/Color eq 'Magenta'", this.edmModel);

            var cmpDog = this.edmModel.FindType("MvcApplication3.Dog");

            semanticTree.Query.As <FilterQueryNode>().Expression.As <BinaryOperatorQueryNode>().Left.As
            <PropertyAccessQueryNode>().Source.As <SingletonNavigationNode>().TypeReference.Definition.Should().Be(cmpDog);
        }
Exemplo n.º 5
0
        public void PrimitiveCollectionTypeShouldBeAllowedUnderComplexType()
        {
            var semanticTree = ModelMaker.GetSemanticTree("People?$filter=MyAddress/MyNeighbors/any(a: a eq 'Christy' )", this.edmModel);

            var cmp = this.edmModel.FindType("Edm.String");

            semanticTree.Query.As <FilterQueryNode>().Expression.As <AnyQueryNode>().Body.As <BinaryOperatorQueryNode>().
            Left.As <ParameterQueryNode>().TypeReference.Definition.Should().Be(cmp);
        }
Exemplo n.º 6
0
 public void WhenAnyIsLedBySingletonNavigationPropertyShouldFail()
 {
     try
     {
         ModelMaker.GetSemanticTree("People?$filter=MyDog/MyPeople/MyDog/MyPeople/any(a: a/MyDog/Color eq 'Simba' )", this.edmModel);
     }
     catch (ODataException)
     {
         return;
     }
     throw new ODataException();
 }