public void WriteStaticCreateMethodParametersForStructuredTypeWithMoreThan5Properties() { string namespacePrefix = string.Empty; Context = new ODataT4CodeGenerator.CodeGenerationContext(ComplexTypeWithMorethan5PropertiesEdmx, namespacePrefix); ODataClientTemplateImp template = new ODataClientTemplateImp(Context); IEdmComplexType complexType = Context.GetSchemaElements("Namespace1").OfType<IEdmComplexType>().First(); KeyValuePair<IEdmProperty, string>[] propertyToParameterNamePairs = complexType.Properties().Select(p => new KeyValuePair<IEdmProperty, string>(p, p.Name)).ToArray(); template.WriteStaticCreateMethodParameters(propertyToParameterNamePairs); List<string> expectedActions = new List<string> { "WriteParameterForStaticCreateMethod(Int32, Id, ParameterSeparator)", "WriteParameterForStaticCreateMethod(String, FirstName, ParameterSeparator)", "WriteParameterForStaticCreateMethod(String, MiddleName, ParameterSeparator)", "WriteParameterForStaticCreateMethod(String, LastName, ParameterSeparator)", "WriteParameterForStaticCreateMethod(Int32, Age, ParameterSeparator)", "WriteParameterForStaticCreateMethod(String, Gender, )" }; template.CalledActions.Should().Equal(expectedActions); }
public void WriteStaticCreateMethodParametersForEmptyStructuredType() { string namespacePrefix = string.Empty; Context = new ODataT4CodeGenerator.CodeGenerationContext(OneNamespaceAndEmptyComplexTypeEdmx, namespacePrefix); ODataClientTemplateImp template = new ODataClientTemplateImp(Context); IEdmComplexType complexType = Context.GetSchemaElements("Namespace1").OfType<IEdmComplexType>().First(); KeyValuePair<IEdmProperty, string>[] propertyToParameterNamePairs = complexType.Properties().Select(p => new KeyValuePair<IEdmProperty, string>(p, p.Name)).ToArray(); template.WriteStaticCreateMethodParameters(propertyToParameterNamePairs); template.CalledActions.Should().BeEmpty(); }