Exemple #1
0
        public void Test_mapping_complex_type_with_complex_element_to_single_acc()
        {
            var mappingFileName = TestUtils.PathToTestResource(@"XSDImporterTest\mapping\SchemaMappingTests\mapping_complex_type_with_complex_element_to_single_acc\mapping.mfd");
            var xsdFileName     = TestUtils.PathToTestResource(@"XSDImporterTest\mapping\SchemaMappingTests\mapping_complex_type_with_complex_element_to_single_acc\invoice\maindoc\UBL-Invoice-2.0.xsd");

            SchemaMapping mappings = CreateSchemaMapping(mappingFileName, xsdFileName);

            var expectedSimpleTypeMappings = new List <SimpleTypeToCdtMapping>();


            var issueDateTypeMapping = new ComplexTypeToCdtMapping("Issue", "IssueDateType", new List <ElementMapping>())
            {
                TargetCdt = cdtDateTime
            };


            var orderReferenceTypeMapping = new ComplexTypeToAccMapping("OrderReference", "OrderReferenceType",
                                                                        new List <ElementMapping>
            {
                new AttributeOrSimpleElementOrComplexElementToBccMapping(new SourceItem("IssueDate", null, XsdObjectType.Element, null), bccIssue, issueDateTypeMapping),
            });

            var expectedComplexTypeMappings = new List <IMapping>
            {
                issueDateTypeMapping,
                orderReferenceTypeMapping,
            };

            var expectedRootElementMapping = new AsmaMapping(new SourceItem("OrderReference", null, XsdObjectType.Element, null))
            {
                TargetMapping = orderReferenceTypeMapping
            };

            AssertMappings(mappings, expectedComplexTypeMappings, expectedSimpleTypeMappings, expectedRootElementMapping);
        }
Exemple #2
0
        public void Test_mapping_complex_type_with_simple_elements_and_attributes_to_cdt()
        {
            var mappingFileName = TestUtils.PathToTestResource(@"XSDImporterTest\mapping\SchemaMappingTests\mapping_complex_type_with_simple_elements_and_attributes_to_cdt\mapping.mfd");
            var xsdFileName     = TestUtils.PathToTestResource(@"XSDImporterTest\mapping\SchemaMappingTests\mapping_complex_type_with_simple_elements_and_attributes_to_cdt\source.xsd");

            SchemaMapping mappings = CreateSchemaMapping(mappingFileName, xsdFileName);

            var textTypeMapping = new ComplexTypeToCdtMapping("Text", "TextType",
                                                              new List <ElementMapping>
            {
                new AttributeOrSimpleElementToSupMapping(new SourceItem("Language", null, XsdObjectType.Attribute, null), supTextLanguage),
                new AttributeOrSimpleElementToSupMapping(new SourceItem("LanguageLocale", null, XsdObjectType.Attribute, null), supTextLanguageLocale),
            });

            var addressTypeMapping = new ComplexTypeToAccMapping("Address", "AddressType",
                                                                 new List <ElementMapping>
            {
                new AttributeOrSimpleElementOrComplexElementToBccMapping(new SourceItem("CityName", null, XsdObjectType.Element, null), bccCityName, textTypeMapping),
            });


            var expectedComplexTypeMappings = new List <IMapping>
            {
                textTypeMapping,
                addressTypeMapping,
            };

            var expectedRootElementMapping = new AsmaMapping(new SourceItem("Address", null, XsdObjectType.Element, null))
            {
                TargetMapping = addressTypeMapping
            };

            AssertMappings(mappings, expectedComplexTypeMappings, new List <SimpleTypeToCdtMapping>(), expectedRootElementMapping);
        }
Exemple #3
0
        public void Test_mapping_two_complex_types_with_complex_elements_to_duplicated_bcc()
        {
            var mappingFileName = TestUtils.PathToTestResource(@"XSDImporterTest\mapping\SchemaMappingTests\mapping_two_complex_types_with_complex_elements_to_duplicated_bcc\mapping.mfd");
            var xsdFileName     = TestUtils.PathToTestResource(@"XSDImporterTest\mapping\SchemaMappingTests\mapping_two_complex_types_with_complex_elements_to_duplicated_bcc\source.xsd");

            SchemaMapping mappings = CreateSchemaMapping(mappingFileName, xsdFileName);

            var textTypeToTextMapping = new ComplexTypeToCdtMapping("Text", "TextType",
                                                                    new List <ElementMapping>
            {
                new AttributeOrSimpleElementToSupMapping(new SourceItem("Language", null, XsdObjectType.Attribute, null), supTextLanguage),
            });

            var austrianAddressTypeMapping = new ComplexTypeToAccMapping("AustrianAddress", "AustrianAddressType",
                                                                         new List <ElementMapping>
            {
                new AttributeOrSimpleElementOrComplexElementToBccMapping(new SourceItem("CityName", null, XsdObjectType.Element, null), bccCityName, textTypeToTextMapping),
            });

            var indianAddressTypeMapping = new ComplexTypeToAccMapping("IndianAddress", "IndianAddressType",
                                                                       new List <ElementMapping>
            {
                new AttributeOrSimpleElementOrComplexElementToBccMapping(new SourceItem("CityName", null, XsdObjectType.Element, null), bccCityName, textTypeToTextMapping),
            });

            var addressBookTypeMapping = new ComplexTypeToMaMapping("AddressBook", "AddressBookType",
                                                                    new List <ElementMapping>
            {
                new AsmaMapping(new SourceItem("AustrianAddress", null, XsdObjectType.Element, null))
                {
                    TargetMapping = austrianAddressTypeMapping
                },
                new AsmaMapping(new SourceItem("IndianAddress", null, XsdObjectType.Element, null))
                {
                    TargetMapping = indianAddressTypeMapping
                },
            });


            var expectedComplexTypeMappings = new List <IMapping>
            {
                textTypeToTextMapping,
                austrianAddressTypeMapping,
                indianAddressTypeMapping,
                addressBookTypeMapping,
            };

            var expectedRootElementMapping = new AsmaMapping(new SourceItem("InternationalAddressBook", null, XsdObjectType.Element, null))
            {
                TargetMapping = addressBookTypeMapping
            };

            AssertMappings(mappings, expectedComplexTypeMappings, new List <SimpleTypeToCdtMapping>(), expectedRootElementMapping);
        }