Ejemplo n.º 1
0
        public void Service_CreateInputsMethods_PluginDefaultValueSet_DefaultValueReturned()
        {
            //------------Setup for test--------------------------
            var service = new Service();

            #region Test String

            const string input = @"<Action Name=""EmitStringData"" Type=""Plugin"" SourceName=""Anything To Xml Hook Plugin"" SourceMethod=""EmitStringData"" NativeType=""String"">
  <Inputs>
    <Input Name=""StringData"" Source=""StringData"" DefaultValue=""XXX"" NativeType=""String"" EmptyToNull=""true"">
      <Validator Type=""Required"" />
    </Input>
  </Inputs>
  <Outputs>
    <Output Name=""CompanyName"" MapsTo=""CompanyName"" Value=""[[Names().CompanyName]]"" Recordset=""Names"" />
    <Output Name=""DepartmentName"" MapsTo=""DepartmentName"" Value=""[[Names().DepartmentName]]"" Recordset=""Names"" />
    <Output Name=""EmployeeName"" MapsTo=""EmployeeName"" Value=""[[Names().EmployeeName]]"" Recordset=""Names"" />
  </Outputs>
  <OutputDescription><![CDATA[<z:anyType xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:d1p1=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph.Ouput"" i:type=""d1p1:OutputDescription"" xmlns:z=""http://schemas.microsoft.com/2003/10/Serialization/"">
                <d1p1:DataSourceShapes xmlns:d2p1=""http://schemas.microsoft.com/2003/10/Serialization/Arrays"">
                  <d2p1:anyType i:type=""d1p1:DataSourceShape"">
                    <d1p1:Paths>
                      <d2p1:anyType xmlns:d5p1=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph.String.Xml"" i:type=""d5p1:XmlPath"">
                        <ActualPath xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Company:Name</ActualPath>
                        <DisplayPath xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Company:Name</DisplayPath>
                        <OutputExpression xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">[[Names().CompanyName]]</OutputExpression>
                        <SampleData xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Dev2</SampleData>
                      </d2p1:anyType>
                      <d2p1:anyType xmlns:d5p1=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph.String.Xml"" i:type=""d5p1:XmlPath"">
                        <ActualPath xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Company.Motto</ActualPath>
                        <DisplayPath xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Company.Motto</DisplayPath>
                        <OutputExpression xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"" />
                        <SampleData xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Eat lots of cake</SampleData>
                      </d2p1:anyType>
                      <d2p1:anyType xmlns:d5p1=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph.String.Xml"" i:type=""d5p1:XmlPath"">
                        <ActualPath xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Company.PreviousMotto</ActualPath>
                        <DisplayPath xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Company.PreviousMotto</DisplayPath>
                        <OutputExpression xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"" />
                        <SampleData xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"" />
                      </d2p1:anyType>
                      <d2p1:anyType xmlns:d5p1=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph.String.Xml"" i:type=""d5p1:XmlPath"">
                        <ActualPath xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Company.Departments:TestAttrib</ActualPath>
                        <DisplayPath xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Company.Departments:TestAttrib</DisplayPath>
                        <OutputExpression xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"" />
                        <SampleData xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">testing</SampleData>
                      </d2p1:anyType>
                      <d2p1:anyType xmlns:d5p1=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph.String.Xml"" i:type=""d5p1:XmlPath"">
                        <ActualPath xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Company.Departments().Department:Name</ActualPath>
                        <DisplayPath xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Company.Departments().Department:Name</DisplayPath>
                        <OutputExpression xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">[[Names().DepartmentName]]</OutputExpression>
                        <SampleData xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Dev,Accounts</SampleData>
                      </d2p1:anyType>
                      <d2p1:anyType xmlns:d5p1=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph.String.Xml"" i:type=""d5p1:XmlPath"">
                        <ActualPath xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Company.Departments().Department.Employees().Person:Name</ActualPath>
                        <DisplayPath xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Company.Departments.Department.Employees().Person:Name</DisplayPath>
                        <OutputExpression xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">[[Names().EmployeeName]]</OutputExpression>
                        <SampleData xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Brendon,Jayd</SampleData>
                      </d2p1:anyType>
                      <d2p1:anyType xmlns:d5p1=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph.String.Xml"" i:type=""d5p1:XmlPath"">
                        <ActualPath xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Company.Departments().Department.Employees().Person:Surename</ActualPath>
                        <DisplayPath xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Company.Departments.Department.Employees().Person:Surename</DisplayPath>
                        <OutputExpression xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"" />
                        <SampleData xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Page,Page</SampleData>
                      </d2p1:anyType>
                      <d2p1:anyType xmlns:d5p1=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph.String.Xml"" i:type=""d5p1:XmlPath"">
                        <ActualPath xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Company().InlineRecordSet</ActualPath>
                        <DisplayPath xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Company().InlineRecordSet</DisplayPath>
                        <OutputExpression xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"" />
                        <SampleData xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">
    RandomData
   ,
    RandomData1
   </SampleData>
                      </d2p1:anyType>
                      <d2p1:anyType xmlns:d5p1=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph.String.Xml"" i:type=""d5p1:XmlPath"">
                        <ActualPath xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Company().OuterNestedRecordSet().InnerNestedRecordSet:ItemValue</ActualPath>
                        <DisplayPath xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">Company.OuterNestedRecordSet().InnerNestedRecordSet:ItemValue</DisplayPath>
                        <OutputExpression xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"" />
                        <SampleData xmlns=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph"">val1,val2</SampleData>
                      </d2p1:anyType>
                    </d1p1:Paths>
                  </d2p1:anyType>
                </d1p1:DataSourceShapes>
                <d1p1:Format>ShapedXML</d1p1:Format>
              </z:anyType>]]></OutputDescription>
</Action>";

            #endregion

            //------------Execute Test---------------------------

            XElement xe = XElement.Parse(input);
            ServiceMethod sm = service.CreateInputsMethod(xe);

            //------------Assert Results-------------------------

            Assert.AreEqual("XXX", sm.Parameters[0].DefaultValue);
        }