Testing 当具有已导入架构的架构时,如何使用BizTalk TestableReceivePipeline

Testing 当具有已导入架构的架构时,如何使用BizTalk TestableReceivePipeline,testing,biztalk,pipeline,Testing,Biztalk,Pipeline,在Microsoft BizTalk 2009下,我们希望使用内置的TestableReceivePipeline类测试ReceivePipeline(它有一个平面文件反汇编程序)。 如果我们只使用一个模式,它可以正常工作,但是当我们尝试使用一个模式(Schema1)时,它会抛出一个错误(System.Xml.Schema.XmlSchemaException:未声明'ABC'元素)。 为什么我会犯这个错误 管道测试规范: StringCollection documents =

在Microsoft BizTalk 2009下,我们希望使用内置的TestableReceivePipeline类测试ReceivePipeline(它有一个平面文件反汇编程序)。 如果我们只使用一个模式,它可以正常工作,但是当我们尝试使用一个模式(Schema1)时,它会抛出一个错误(System.Xml.Schema.XmlSchemaException:未声明'ABC'元素)。 为什么我会犯这个错误

管道测试规范:

        StringCollection documents = new StringCollection();
        documents.Add(@"c:\Test.dat");

        StringCollection parts = new StringCollection();

        Dictionary<string, string> schemas = new Dictionary<string, string>();
        schemas.Add("MyCompany.Schema2", @"C:\Schema2.xsd");
        schemas.Add("MyCompany.Schema1", @"C:\Schema1.xsd");

        Microsoft.BizTalk.TestTools.Pipeline.TestableReceivePipeline pipeline = new MyReceivePipeline();
        pipeline.TestPipeline(documents, parts, schemas);
StringCollection文档=新建StringCollection();
添加(@“c:\Test.dat”);
StringCollection部件=新StringCollection();
字典模式=新字典();
schemas.Add(“MyCompany.Schema2”,@“C:\Schema2.xsd”);
schemas.Add(“MyCompany.Schema1”,@“C:\Schema1.xsd”);
Microsoft.BizTalk.TestTools.Pipeline.TestableReceivePipeline管道=新建MyReceivePipeline();
TestPipeline(文档、部件、模式);
Schema1.xsd源代码:

<xs:import schemaLocation=".\Schema2.xsd" namespace="http://MyCompany.Schema2" />
<xs:element name="Schema1">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="Header">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="ClientRef" type="xs:string">
                            <xs:annotation>
                                <xs:appinfo>
                                    <b:fieldInfo justification="left" sequence_number="1" wrap_char_type="default" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
                                </xs:appinfo>
                            </xs:annotation>
                        </xs:element>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element ref="ns1:Data" />
            <xs:element name="Tail">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="RecordCount" type="xs:int">
                            <xs:annotation>
                                <xs:appinfo>
                                    <b:fieldInfo justification="left" sequence_number="3" wrap_char_type="default" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
                                </xs:appinfo>
                            </xs:annotation>
                        </xs:element>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
</xs:element>
<xs:element name="Data">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="FirstName" type="xs:string" nillable="true">
                <xs:annotation>
                    <xs:appinfo>
                        <b:fieldInfo justification="left" wrap_char_type="default" sequence_number="2" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
                    </xs:appinfo>
                </xs:annotation>
            </xs:element>
            <xs:element name="Surname" type="xs:string" nillable="true">
                <xs:annotation>
                    <xs:appinfo>
                        <b:fieldInfo justification="left" sequence_number="3" wrap_char_type="default" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
                    </xs:appinfo>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
</xs:element>

Schema2.xsd源代码:

<xs:import schemaLocation=".\Schema2.xsd" namespace="http://MyCompany.Schema2" />
<xs:element name="Schema1">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="Header">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="ClientRef" type="xs:string">
                            <xs:annotation>
                                <xs:appinfo>
                                    <b:fieldInfo justification="left" sequence_number="1" wrap_char_type="default" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
                                </xs:appinfo>
                            </xs:annotation>
                        </xs:element>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element ref="ns1:Data" />
            <xs:element name="Tail">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="RecordCount" type="xs:int">
                            <xs:annotation>
                                <xs:appinfo>
                                    <b:fieldInfo justification="left" sequence_number="3" wrap_char_type="default" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
                                </xs:appinfo>
                            </xs:annotation>
                        </xs:element>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
</xs:element>
<xs:element name="Data">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="FirstName" type="xs:string" nillable="true">
                <xs:annotation>
                    <xs:appinfo>
                        <b:fieldInfo justification="left" wrap_char_type="default" sequence_number="2" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
                    </xs:appinfo>
                </xs:annotation>
            </xs:element>
            <xs:element name="Surname" type="xs:string" nillable="true">
                <xs:annotation>
                    <xs:appinfo>
                        <b:fieldInfo justification="left" sequence_number="3" wrap_char_type="default" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
                    </xs:appinfo>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
</xs:element>


AFAIK BizTalk 2009目前不支持此操作