Exemplo n.º 1
0
        public void ComplexType_returns_type_when_complex_property()
        {
            var complexType = new ComplexType();

            var property = EdmProperty.CreateComplex("P", complexType);

            Assert.Same(complexType, property.ComplexType);
        }
Exemplo n.º 2
0
        public void IsComplexType_returns_true_when_complex_property()
        {
            var complexType = new ComplexType();

            var property = EdmProperty.CreateComplex("P", complexType);

            Assert.False(property.IsPrimitiveType);
            Assert.False(property.IsEnumType);
            Assert.True(property.IsComplexType);
        }
Exemplo n.º 3
0
        public void Complex_should_create_complex_property()
        {
            var complexType = new ComplexType();

            var property = EdmProperty.CreateComplex("P", complexType);

            Assert.NotNull(property);
            Assert.NotNull(property.TypeUsage);
            Assert.Same(complexType, property.TypeUsage.EdmType);
        }
Exemplo n.º 4
0
        public void WriteFunctionMapping_should_write_complex_parameter_bindings()
        {
            var fixture = new Fixture();

            var entityType = new EntityType("E", "N", DataSpace.CSpace);
            var entitySet  = new EntitySet("ES", "S", null, null, entityType);

            new EntityContainer("EC", DataSpace.SSpace).AddEntitySetBase(entitySet);

            var storageModificationFunctionMapping
                = new ModificationFunctionMapping(
                      entitySet,
                      entityType,
                      new EdmFunction("F", "N", DataSpace.SSpace, new EdmFunctionPayload()),
                      new[]
            {
                new ModificationFunctionParameterBinding(
                    new FunctionParameter(
                        "P",
                        TypeUsage.Create(PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Int32)),
                        ParameterMode.In),
                    new ModificationFunctionMemberPath(
                        new[]
                {
                    EdmProperty.CreateComplex("C1", new ComplexType()),
                    EdmProperty.CreateComplex("C2", new ComplexType()),
                    new EdmProperty("M")
                },
                        null),
                    true)
            },
                      null,
                      null);

            fixture.Writer.WriteFunctionMapping("InsertFunction", storageModificationFunctionMapping);

            Assert.Equal(
                @"<InsertFunction FunctionName=""N.F"">
  <ComplexProperty Name=""C1"" TypeName=""."">
    <ComplexProperty Name=""C2"" TypeName=""."">
      <ScalarProperty Name=""M"" ParameterName=""P"" Version=""Current"" />
    </ComplexProperty>
  </ComplexProperty>
</InsertFunction>",
                fixture.ToString());
        }
Exemplo n.º 5
0
        public void UnderlyingPrimitiveType_returns_type_when_underlying_primitive_property()
        {
            var primitiveType = PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Int32);

            var property = EdmProperty.CreatePrimitive("P", primitiveType);

            Assert.Same(primitiveType, property.UnderlyingPrimitiveType);

            var enumType = new EnumType();

            property = EdmProperty.CreateEnum("P", enumType);

            Assert.Same(primitiveType, property.UnderlyingPrimitiveType);

            var complexType = new ComplexType();

            property = EdmProperty.CreateComplex("P", complexType);

            Assert.Null(property.UnderlyingPrimitiveType);
        }