public static DataLoaderBase CreateInputContext(TestContext testContextInstance, string propertyName, string propertyNamespace, string value = "ExpectedResult", bool promoted = false) { var xdl = new b.TestSteps.DataLoaders.Xml.XmlDataLoader(); xdl.FilePath = testContextInstance.TestDir + @"\..\..\BREPipelineFramework.UnitTests\Sample Files\Input Context Files\Base Context.xml";; xdl.UpdateXml = new System.Collections.ObjectModel.Collection <b.TestSteps.Common.XPathDefinition>(); xdl.UpdateXml.Add(new b.TestSteps.Common.XPathDefinition { XPath = "/*[local-name()='MessageInfo' and namespace-uri()='']/*[local-name()='ContextInfo' and namespace-uri()='']/*[local-name()='Property' and namespace-uri()='']/@*[local-name()='Name' and namespace-uri()='']", Value = propertyName }); xdl.UpdateXml.Add(new b.TestSteps.Common.XPathDefinition { XPath = "/*[local-name()='MessageInfo' and namespace-uri()='']/*[local-name()='ContextInfo' and namespace-uri()='']/*[local-name()='Property' and namespace-uri()='']/@*[local-name()='Namespace' and namespace-uri()='']", Value = propertyNamespace }); xdl.UpdateXml.Add(new b.TestSteps.Common.XPathDefinition { XPath = "/*[local-name()='MessageInfo' and namespace-uri()='']/*[local-name()='ContextInfo' and namespace-uri()='']/*[local-name()='Property' and namespace-uri()='']/@*[local-name()='Value' and namespace-uri()='']", Value = value }); if (promoted) { xdl.UpdateXml.Add(new b.TestSteps.Common.XPathDefinition { XPath = "/*[local-name()='MessageInfo' and namespace-uri()='']/*[local-name()='ContextInfo' and namespace-uri()='']/*[local-name()='Property' and namespace-uri()='']/@*[local-name()='Promoted' and namespace-uri()='']", Value = "true" }); } else { xdl.UpdateXml.Add(new b.TestSteps.Common.XPathDefinition { XPath = "/*[local-name()='MessageInfo' and namespace-uri()='']/*[local-name()='ContextInfo' and namespace-uri()='']/*[local-name()='Property' and namespace-uri()='']/@*[local-name()='Promoted' and namespace-uri()='']", Value = "false" }); } return(xdl); }
public void TestMethod_97() { var wcfTestCase = new b.Xaml.TestCase(); var wcfTestStep = new WcfTestStep(); var xdl = new b.TestSteps.DataLoaders.Xml.XmlDataLoader(); xdl.FilePath = testContextInstance.TestDir + @"\..\..\Test\BizUnit.TestSteps.i8c.Tests\TestData\Input.xml"; xdl.UpdateXml = new System.Collections.ObjectModel.Collection <b.TestSteps.Common.XPathDefinition>(); xdl.UpdateXml.Add(new b.TestSteps.Common.XPathDefinition { XPath = "/*[local-name()='CompositeType' and namespace-uri()='']/*[local-name()='FirstValue' and namespace-uri()='']", Value = "36" }); xdl.UpdateXml.Add(new b.TestSteps.Common.XPathDefinition { XPath = "/*[local-name()='CompositeType' and namespace-uri()='']/*[local-name()='SecondValue' and namespace-uri()='']", Value = "61" }); wcfTestStep.DataLoader = xdl; wcfTestStep.EndpointName = "BasicHttpBinding_IService1"; wcfTestStep.InputMessageTypeName = "BizUnit.TestSteps.i8c.Tests.ExampleServiceReference.CompositeType, BizUnit.TestSteps.i8c.Tests"; wcfTestStep.InterfaceTypeName = "BizUnit.TestSteps.i8c.Tests.ExampleServiceReference.IService1, BizUnit.TestSteps.i8c.Tests"; wcfTestStep.MethodName = "GetDataUsingDataContract"; var xmlvalidationstep = new b.TestSteps.ValidationSteps.Xml.XmlValidationStep(); xmlvalidationstep.XmlSchemas = new System.Collections.ObjectModel.Collection <b.TestSteps.ValidationSteps.Xml.SchemaDefinition>(); xmlvalidationstep.XPathValidations = new System.Collections.ObjectModel.Collection <b.TestSteps.Common.XPathDefinition>(); xmlvalidationstep.XmlSchemas.Add(new b.TestSteps.ValidationSteps.Xml.SchemaDefinition { XmlSchemaPath = testContextInstance.TestDir + @"\..\..\Test\BizUnit.TestSteps.i8c.Tests\TestData\CompositeTypeSchema.xsd", XmlSchemaNameSpace = "" }); var xpathDef = new b.TestSteps.Common.XPathDefinition(); xpathDef.XPath = "/*[local-name()='CompositeType' and namespace-uri()='']/*[local-name()='Result' and namespace-uri()='']"; xpathDef.Value = "97"; xmlvalidationstep.XPathValidations.Add(xpathDef); wcfTestStep.SubSteps.Add(xmlvalidationstep); wcfTestCase.ExecutionSteps.Add(wcfTestStep); var bizunit = new b.BizUnit(wcfTestCase); bizunit.RunTest(); }
public static DataLoaderBase CreateInstanceConfig(TestContext testContextInstance, string applicationContext = null, string fileName = "Base Config.xml") { var xdl = new b.TestSteps.DataLoaders.Xml.XmlDataLoader(); xdl.FilePath = testContextInstance.TestDir + @"\..\..\BREPipelineFramework.UnitTests\Sample Files\Instance Config Files\" + fileName; xdl.UpdateXml = new System.Collections.ObjectModel.Collection <b.TestSteps.Common.XPathDefinition>(); if (applicationContext != null) { xdl.UpdateXml.Add(new b.TestSteps.Common.XPathDefinition { XPath = "/*[local-name()='Root' and namespace-uri()='']/*[local-name()='Stages' and namespace-uri()='']/*[local-name()='Stage' and namespace-uri()='']/*[local-name()='Components' and namespace-uri()='']/*[local-name()='Component' and namespace-uri()='']/*[local-name()='Properties' and namespace-uri()='']/*[local-name()='ApplicationContext' and namespace-uri()='']", Value = applicationContext }); } return(xdl); }