Ejemplo n.º 1
0
        public void Upgrade_Elligable_Test()
        {
            var testCase = new TestCase();
            testCase.Name = "Upgrade_Elligable_Test";
            testCase.Purpose = "Test successful upgrade";
            testCase.Description = "Test upgrade succeeds for passenger/flight not elligable for upgrade";
            testCase.Category = "BizUnit SDK: BVT";
            testCase.Reference = "Use case: 10.3.4";
            testCase.ExpectedResults = "Upgrade succeeds";
            testCase.Preconditions = "Solution should be deployed, bound and started";

            // First ensure the target directory is empty...
            var delFiles = new DeleteStep();
            delFiles.FilePathsToDelete = new Collection<string> {@"..\..\..\Data\Out\*.xml"};
            testCase.SetupSteps.Add(delFiles);

            // Then execute the main scenario, execute a response-response web set step which is executed concurrently.
            // i.e. whilst this step is waiting for the response the next step, FileReadMultipleStep and then CreateStep
            // will be executed.
            var wsStep = new WebServiceStep();
            wsStep.Action = "Upgrade";
            wsStep.ServiceUrl = "http://localhost/BizUnit.Sdk.FlightUpgrade/BizUnit_Sdk_FlightUpgrade_ProcessRequest_UpgradePort.svc";
            wsStep.RequestBody = new FileDataLoader { FilePath = @"..\..\..\Tests\FlightUpgrade.Tests\Data\Request.xml" };
            wsStep.RunConcurrently = true;

            // Add validation....
            var validation = new XmlValidationStep();
            var schemaResultType = new SchemaDefinition
            {
                XmlSchemaPath = @"..\..\..\Src\FlightUpgrade\ResponseMsg.xsd",
                XmlSchemaNameSpace = "http://bizUnit.sdk.flightUpgrade/upgradeResponse"
            };
            validation.XmlSchemas.Add(schemaResultType);

            var responseXpath = new XPathDefinition();
            responseXpath.Description = "GetProducts_RS/Result/result";
            responseXpath.XPath = "/*[local-name()='UpgradeResponse' and namespace-uri()='http://bizUnit.sdk.flightUpgrade/upgradeResponse']/*[local-name()='UpgradeResult' and namespace-uri()='']/*[local-name()='Result' and namespace-uri()='']";
            responseXpath.Value = "true";
            validation.XPathValidations.Add(responseXpath);

            var fileReadStep = new FileReadMultipleStep();
            fileReadStep.DirectoryPath = @"..\..\..\Data\Out";
            fileReadStep.SearchPattern = "*.xml";
            fileReadStep.ExpectedNumberOfFiles = 1;
            fileReadStep.Timeout = 5000;
            fileReadStep.DeleteFiles = true;

            var createFileStep = new CreateStep();
            createFileStep.CreationPath = @"..\..\..\Data\In\UpgradeResponse.xml";
            createFileStep.DataSource = new FileDataLoader { FilePath = @"..\..\..\Tests\FlightUpgrade.Tests\Data\Response.xml" };

            testCase.ExecutionSteps.Add(wsStep);
            testCase.ExecutionSteps.Add(fileReadStep);
            testCase.ExecutionSteps.Add(createFileStep);

            var bizUnit = new BizUnit(testCase);
            bizUnit.RunTest();
            TestCase.SaveToFile(testCase, "Upgrade_Elligable_Test.xml");
        }
Ejemplo n.º 2
0
        public void Upgrade_Eligible_Test_FILE()
        {
            var testCase = new TestCase();
            testCase.Name = "Upgrade_Eligible_Test_FILE";
            testCase.Purpose = "Test successful upgrade";
            testCase.Description = "Test upgrade succeeds for passenger/flight eligible for upgrade";
            testCase.Category = "BizUnit SDK: BVT";
            testCase.Reference = "Use case: 10.3.4";
            testCase.ExpectedResults = "Upgrade succeeds";
            testCase.Preconditions = "Solution should be deployed, bound and started";

            // First ensure the target directory is empty...
            var delFiles = new DeleteStep();
            delFiles.FilePathsToDelete = new Collection<string> { @"C:\Temp\BizTalk\BizUnitSdkOut\*.xml" };
            testCase.SetupSteps.Add(delFiles);

            // Then execute the main scenario.
            var testStep = new CreateStep();

            // Where are we going to create the file.
            testStep.CreationPath = @"C:\Temp\BizTalk\BizUnitSdkIn\Request.xml";
            var dataLoader = new FileDataLoader();
            // Where are we getting the original file from?
            dataLoader.FilePath = @"..\..\Data\Request.xml";
            testStep.DataSource = dataLoader;

            testCase.ExecutionSteps.Add(testStep);

            // Add validation....
            var validation = new XmlValidationStep();
            var schemaResultType = new SchemaDefinition
            {
                XmlSchemaPath = @"..\..\..\..\Src\FlightUpgrade\ResponseMsg.xsd",
                XmlSchemaNameSpace = "http://bizUnit.sdk.flightUpgrade/upgradeResponse"
            };
            validation.XmlSchemas.Add(schemaResultType);

            var responseXpath = new XPathDefinition();
            responseXpath.Description = "GetProducts_RS/Result/result";
            responseXpath.XPath = "/*[local-name()='UpgradeResponse' and namespace-uri()='http://bizUnit.sdk.flightUpgrade/upgradeResponse']/*[local-name()='UpgradeResult' and namespace-uri()='']/*[local-name()='Result' and namespace-uri()='']";
            responseXpath.Value = "true";
            validation.XPathValidations.Add(responseXpath);

            // Check that an output file has been created.
            var finalFileReadStep = new FileReadMultipleStep();
            finalFileReadStep.DirectoryPath = @"C:\Temp\BizTalk\BizUnitSdkOut";
            finalFileReadStep.SearchPattern = "*.xml";
            finalFileReadStep.ExpectedNumberOfFiles = 1;
            finalFileReadStep.Timeout = 5000;
            finalFileReadStep.DeleteFiles = false;

            finalFileReadStep.SubSteps.Add(validation);
            testCase.ExecutionSteps.Add(finalFileReadStep);

            var bizUnit = new BizUnit(testCase);
            bizUnit.RunTest();
            TestCase.SaveToFile(testCase, System.String.Format("Upgrade_Eligible_Test_File_{0}.xml", System.String.Format("{0:yyyy-MM-dd-hh_mm_ss}",  System.DateTime.Now)));
        }
        public void StandardOrderShouldBeSavedInCorrectFolder()
        {
            var testCase = new TestCase { Name = "Test that standard order is saved in correct folder" };

            testCase.SetupSteps.Add(DeleteFilesStep());

            testCase.ExecutionSteps.Add(CreateFileStep());

            testCase.ExecutionSteps.Add(ValidateFileExits());

            var bizUnit = new BizUnit.BizUnit(testCase);
            bizUnit.RunTest();
        }
 public void IntegrationTest_With_Valid_Message_In()
 {
     TestCase testCase = new TestCase { Name = MethodBase.GetCurrentMethod().Name };
     MsmqPurgeStep msmqPurgeStep1 = new MsmqPurgeStep
         {
             FailOnError = true,
             Name = "Purge 'MessageIn'.",
             QueuePath = ".\\private$\\AcmeCorp.BizTalkBuildSample.MessageIn"
         };
     testCase.ExecutionSteps.Add(msmqPurgeStep1);
     MsmqPurgeStep msmqPurgeStep2 = new MsmqPurgeStep
         {
             FailOnError = true,
             Name = "Purge 'MessageOut'.",
             QueuePath = ".\\private$\\AcmeCorp.BizTalkBuildSample.MessageOut"
         };
     testCase.ExecutionSteps.Add(msmqPurgeStep2);
     XmlDocument messageBody = new XmlDocument();
     messageBody.LoadXml(@"<ns0:Root xmlns:ns0='http://schemas.AcmeCorp.com/BizTalkBuildSample/MessageIn'><ValueIn>ValueIn_0</ValueIn></ns0:Root>");
     MsmqWriteStep msmqWriteStep = new MsmqWriteStep
         {
             FailOnError = true,
             Name = "Write 'MessageIn' message to MSMQ.",
             QueuePath = ".\\private$\\AcmeCorp.BizTalkBuildSample.MessageIn",
             MessageBodyContent = messageBody
         };
     testCase.ExecutionSteps.Add(msmqWriteStep);
     XPathDefinition xpathDefinition = new XPathDefinition { Value = "ValueIn_0", XPath = "/*[local-name()='Root']/*[local-name()='ValueOut']" };
     XPathValidationStep xpathValidationStep = new XPathValidationStep();
     xpathValidationStep.XPathValidations.Add(xpathDefinition);
     MsmqReadStep msmqReadStep = new MsmqReadStep
         {
             FailOnError = true,
             Name = "Read 'MessageOut' message from MSMQ.",
             QueuePath = ".\\private$\\AcmeCorp.BizTalkBuildSample.MessageOut",
             TimeoutInMilliseconds = ThirtySecondsInMilliseconds
         };
     msmqReadStep.SubSteps = new Collection<SubStepBase>();
     msmqReadStep.SubSteps.Add(xpathValidationStep);
     testCase.ExecutionSteps.Add(msmqReadStep);
     BizUnit.BizUnit bizUnit = new BizUnit.BizUnit(testCase);
     bizUnit.RunTest();
 }
Ejemplo n.º 5
0
        public void Upgrade_NotElligable_Test()
        {
            var testCase = new TestCase();
            testCase.Name = "Upgrade_NotElligable_Test";
            testCase.Purpose = "Test failed upgrade";
            testCase.Description = "Test upgrade denied for passenger/flight not elligable for upgrade";
            testCase.Category = "BizUnit SDK: BVT";
            testCase.Reference = "Use case: 10.3.5";
            testCase.ExpectedResults = "Upgrade failed";
            testCase.Preconditions = "Solution should be deployed, bound and started";

            var wsStep = new WebServiceStep();
            wsStep.Action = "Upgrade";
            wsStep.ServiceUrl = "http://localhost/BizUnit.Sdk.FlightUpgrade/BizUnit_Sdk_FlightUpgrade_ProcessRequest_UpgradePort.svc";
            wsStep.RequestBody = new FileDataLoader { FilePath = @"..\..\..\Tests\FlightUpgrade.Tests\Data\Request_NotElligible.xml" };
            wsStep.RunConcurrently = true;

            // Add validation....
            var validation = new XmlValidationStep();
            var schemaResultType = new SchemaDefinition
            {
                XmlSchemaPath = @"..\..\..\Src\FlightUpgrade\ResponseMsg.xsd",
                XmlSchemaNameSpace = "http://bizUnit.sdk.flightUpgrade/upgradeResponse"
            };
            validation.XmlSchemas.Add(schemaResultType);

            var responseXpath = new XPathDefinition();
            responseXpath.Description = "GetProducts_RS/Result/result";
            responseXpath.XPath = "/*[local-name()='UpgradeResponse' and namespace-uri()='http://bizUnit.sdk.flightUpgrade/upgradeResponse']/*[local-name()='UpgradeResult' and namespace-uri()='']/*[local-name()='Result' and namespace-uri()='']";
            responseXpath.Value = "false";
            validation.XPathValidations.Add(responseXpath);

            wsStep.SubSteps.Add(validation);

            testCase.ExecutionSteps.Add(wsStep);

            var bizUnit = new BizUnit(testCase);
            bizUnit.RunTest();
            TestCase.SaveToFile(testCase, "Upgrade_NotElligable_Test.xml");
        }
Ejemplo n.º 6
0
        public void Upgrade_NotElligable_NoResponseValidation_Test()
        {
            var testCase = new TestCase();
            testCase.Name = "Upgrade_NotElligable_NoResponseValidation_Test";
            testCase.Purpose = "Test failed upgrade";
            testCase.Description = "Test upgrade denied for passenger/flight not elligable for upgrade";
            testCase.Category = "BizUnit SDK: BVT";
            testCase.Reference = "Use case: 10.3.5";
            testCase.ExpectedResults = "Upgrade failed";
            testCase.Preconditions = "Solution should be deployed, bound and started";

            var wsStep = new WebServiceStep();
            wsStep.Action = "Upgrade";
            wsStep.ServiceUrl = "http://localhost/BizUnit.Sdk.FlightUpgrade/BizUnit_Sdk_FlightUpgrade_ProcessRequest_UpgradePort.svc";
            wsStep.RequestBody = new FileDataLoader { FilePath = @"..\..\..\Tests\FlightUpgrade.Tests\Data\Request_NotElligible.xml" };
            wsStep.RunConcurrently = true;

            testCase.ExecutionSteps.Add(wsStep);

            var bizUnit = new BizUnit(testCase);
            bizUnit.RunTest();
            TestCase.SaveToFile(testCase, "Upgrade_NotElligable_NoResponseValidation_Test.xml");
        }
Ejemplo n.º 7
0
 ///<summary>
 /// Used to save a TestCase to a string in Xaml format
 ///</summary>
 ///<param name="testCase">The TestCase to be saved to disc</param>
 ///<returns>The test case in Xaml format</returns>
 public static string Save(TestCase testCase)
 {
     return BizUnitSerializationHelper.Serialize(testCase);
 }
Ejemplo n.º 8
0
 ///<summary>
 /// Used to save a TestCase to disc in Xaml format
 ///</summary>
 ///<param name="testCase">The TestCase to be saved to disc</param>
 ///<param name="filePath">The file path of the Xaml test case representaiton.</param>
 public static void SaveToFile(TestCase testCase, string filePath)
 {
     BizUnitSerializationHelper.SaveToFile(testCase, filePath);
 }
Ejemplo n.º 9
0
 ///<summary>
 /// Used to save a TestCase to a string in Xaml format
 ///</summary>
 ///<param name="testCase">The TestCase to be saved to disc</param>
 ///<returns>The test case in Xaml format</returns>
 public static string Save(TestCase testCase)
 {
     return(BizUnitSerializationHelper.Serialize(testCase));
 }
Ejemplo n.º 10
0
        /// <summary>
        /// BizUnit constructor, introduced in BizUnit 4.0 
        /// </summary>
        /// <param name="testCase">The BizUnit test case object model that has been built to represent the test to be executed.</param>
        /// <param name="ctx">The BizUnit test context to be used. If this is not supplied a new contxt will created.</param>
        /// 
        /// <remarks>
        /// From BizUnit 4.0 test case maybe programatically created by creating
        /// test steps, configuring them and then adding them to a test case or 
        /// by loading Xaml test cases. Test cases developed programatically 
        /// maybe serialised to Xaml using TestCase.SaveToFile(), 
        /// similarly Xaml test cases maybe deserialised into a 
        /// TestCase using TestCase.LoadFromFile(). 
        /// 
        /// The exmaple below illustrates loading and running a Xaml test case:
        /// 
        /// <code escaped="true">
        ///	namespace WoodgroveBank.BVTs
        ///	{
        ///	using System;
        ///	using NUnit.Framework;
        ///	using BizUnit;
        ///
        ///	[TestMethod]
        ///	public class SampleTests
        ///	{
        ///		[Test]
        ///		public void ExecuteXamlTestCase()
        ///		{
        ///         // Load the Xaml test case...
        ///         var bu = new BizUnit(TestCase.LoadFromFile("DelayTestCaseTest.xaml"));
        ///         
        ///         // Run the test...
        ///         bu.RunTest();
        ///		}
        ///	}		
        ///	</code>
        ///	
        /// The exmaple below illustrates programtically creating a test case and subsequently running it:
        /// 
        /// <code escaped="true">
        ///	namespace WoodgroveBank.BVTs
        ///	{
        ///	using System;
        ///	using NUnit.Framework;
        ///	using BizUnit;
        ///
        ///	[TestMethod]
        ///	public class SampleTests
        ///	{
        ///		[Test]
        ///		public void ExecuteProgramaticallyCreatedTestCase()
        ///		{
        ///         int stepDelayDuration = 500;
        ///         var step = new DelayStep();
        ///         step.DelayMilliSeconds = stepDelayDuration;
        ///
        ///         var sw = new Stopwatch();
        ///         sw.Start();
        ///
        ///         var tc = new TestCase();
        ///         tc.ExecutionSteps.Add(step);
        ///         
        ///         // If we wanted to serialise the test case:
        ///         // TestCase.SaveToFile(tc, "DelayTestCaseTest.xaml");
        /// 
        ///         var bu = new BizUnit(tc));
        ///
        ///         sw = new Stopwatch().Start();
        ///
        ///         // Run the test case...
        ///         bu.RunTest();
        ///
        ///         var actualDuration = sw.ElapsedMilliseconds;
        ///         Console.WriteLine("Observed delay: {0}", actualDuration);
        ///         Assert.AreEqual(actualDuration, stepDelayDuration, 20);
        ///		}
        ///	}		
        ///	</code>
        /// 
        ///	</remarks>
        public BizUnit(TestCase testCase, Context ctx)
        {
            ArgumentValidation.CheckForNullReference(testCase, "testCase");
            ArgumentValidation.CheckForNullReference(ctx, "ctx");

            _logger = ctx.Logger;
            LoadXamlTestCaseAndInit(testCase, TestGroupPhase.Unknown, ctx);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// BizUnit constructor, introduced in BizUnit 4.0 
        /// </summary>
        /// <param name="testCase">The BizUnit test case object model that has been built to represent the test to be executed.</param>
        /// 
        /// <remarks>
        /// From BizUnit 4.0 test case maybe programatically created by creating
        /// test steps, configuring them and then adding them to a test case or 
        /// by loading Xaml test cases. Test cases developed programatically 
        /// maybe serialised to Xaml using TestCase.SaveToFile(), 
        /// similarly Xaml test cases maybe deserialised into a 
        /// TestCase using TestCase.LoadFromFile(). 
        /// 
        /// The exmaple below illustrates loading and running a Xaml test case:
        /// 
        /// <code escaped="true">
        ///	namespace WoodgroveBank.BVTs
        ///	{
        ///	using System;
        ///	using NUnit.Framework;
        ///	using BizUnit;
        ///
        ///	[TestMethod]
        ///	public class SampleTests
        ///	{
        ///		[Test]
        ///		public void ExecuteXamlTestCase()
        ///		{
        ///         // Load the Xaml test case...
        ///         var bu = new BizUnit(TestCase.LoadFromFile("DelayTestCaseTest.xaml"));
        ///         
        ///         // Run the test...
        ///         bu.RunTest();
        ///		}
        ///	}		
        ///	</code>
        ///	
        /// The exmaple below illustrates programtically creating a test case and subsequently running it:
        /// 
        /// <code escaped="true">
        ///	namespace WoodgroveBank.BVTs
        ///	{
        ///	using System;
        ///	using NUnit.Framework;
        ///	using BizUnit;
        ///
        ///	[TestMethod]
        ///	public class SampleTests
        ///	{
        ///		[Test]
        ///		public void ExecuteProgramaticallyCreatedTestCase()
        ///		{
        ///         int stepDelayDuration = 500;
        ///         var step = new DelayStep();
        ///         step.DelayMilliSeconds = stepDelayDuration;
        ///
        ///         var sw = new Stopwatch();
        ///         sw.Start();
        ///
        ///         var tc = new TestCase();
        ///         tc.ExecutionSteps.Add(step);
        ///         
        ///         // If we wanted to serialise the test case:
        ///         // TestCase.SaveToFile(tc, "DelayTestCaseTest.xaml");
        /// 
        ///         var bu = new BizUnit(tc));
        ///
        ///         sw = new Stopwatch().Start();
        ///
        ///         // Run the test case...
        ///         bu.RunTest();
        ///
        ///         var actualDuration = sw.ElapsedMilliseconds;
        ///         Console.WriteLine("Observed delay: {0}", actualDuration);
        ///         Assert.AreEqual(actualDuration, stepDelayDuration, 20);
        ///		}
        ///	}		
        ///	</code>
        /// 
        ///	</remarks>
        public BizUnit(TestCase testCase)
        {
            ArgumentValidation.CheckForNullReference(testCase, "testCase");

            _context = new Context(this);
            _logger = _context.Logger;
            LoadXamlTestCaseAndInit(testCase, TestGroupPhase.Unknown, _context);
        }
Ejemplo n.º 12
0
        private void RunTestInternal(TestCase xamlTestCase)
        {
            try
            {
                _context.SetTestName(xamlTestCase.Name);

                Setup(xamlTestCase.SetupSteps);
                Execute(xamlTestCase.ExecutionSteps);
                TearDown(xamlTestCase.CleanupSteps);
            }
            finally
            {
                if (null != _logger)
                {
                    _logger.Flush();
                    _logger.Close();
                }
            }

            if (null != _executionException)
            {
                throw _executionException;
            }
        }
Ejemplo n.º 13
0
        private static string GetTestCaseDependancies(TestCase test, string testCaseDirectory, bool searchRecursively)
        {
            var sb = new StringBuilder();
            int numberImports = 0;

            bool importFound = AddImportedTestCases(test.SetupSteps, sb, "Setup test cases: ", false, testCaseDirectory, searchRecursively);
            importFound = AddImportedTestCases(test.ExecutionSteps, sb, "Execution test cases: ", importFound, testCaseDirectory, searchRecursively);
            importFound = AddImportedTestCases(test.CleanupSteps, sb, "Cleanup test cases: ", importFound, testCaseDirectory, searchRecursively);

            return (0 < sb.Length) ? sb.ToString() : "None";
        }
Ejemplo n.º 14
0
        private static string BuildTestCaseFragment(string testCaseTemplate, TestCase test, string testCaseDirectory, bool searchRecursively)
        {
            string result = testCaseTemplate.Replace("##TestCaseName##", test.Name);
            result = result.Replace("##TestCaseDescription##", test.Description);
            result = result.Replace("##TestCasePurpose##", test.Purpose);
            result = result.Replace("##TestCaseReference##", test.Reference);
            result = result.Replace("##TestCasePreconditions##", test.Preconditions);

            result = result.Replace("##TestCaseDependancies##", GetTestCaseDependancies(test, testCaseDirectory, searchRecursively));

            result = result.Replace("##BizUnitVersion##", test.BizUnitVersion);
            return result.Replace("##TestCaseExpectedResults##", test.ExpectedResults);
        }
Ejemplo n.º 15
0
        private void LoadXamlTestCaseAndInit(TestCase testCase, TestGroupPhase phase, Context ctx)
        {
            ArgumentValidation.CheckForNullReference(testCase, "testCase");
            // ctx - optional

            if (null != ctx)
            {
                _context = ctx;
                _context.Initialize(this);
            }
            else
            {
                _context = new Context(this);
                _logger = _context.Logger;
            }

            _xamlTestCase = testCase;
            _testGroupPhase = phase;
            _testName = testCase.Name;
            DateTime now = DateTime.Now;

            // Validate test case...
            testCase.Validate(_context);

            if (phase == TestGroupPhase.Unknown)
            {
                _logger.TestStart(_testName, now, GetUserName());
                _context.Add(BizUnitTestCaseStartTime, now, true);
            }
            else
            {
                _logger.TestGroupStart(testCase.Name, phase, now, GetUserName());
            }
        }
Ejemplo n.º 16
0
        public static b.BizUnit BREPipelineFrameworkSendPipelineBaseTest(string InputFileName, TestContext testContextInstance, string InstanceConfigFilePath = null,
                                                                         XPathCollection contextXPathCollection = null, XPathCollection bodyXPathCollection = null, string PipelineType = "BREPipelineFramework.TestProject.Snd_BREPipelineFramework",
                                                                         string ExpectedOutputFileName          = null, string inputMessageType = "BREPipelineFramework.TestProject.Message", string InputContextFileName = null,
                                                                         DataLoaderBase instanceConfigLoader    = null, DataLoaderBase inputContextLoader = null, string additionalInputType = null, string yetAnotherInputType = null)
        {
            var _BREPipelineFrameworkTest = new b.Xaml.TestCase();

            var pipelineTestStep = new ExecuteSendPipelineWithNullablePropertyStep
            {
                PipelineAssemblyPath = testContextInstance.TestDir + @"\..\..\BREPipelineFramework.TestProject\bin\debug\BREPipelineFramework.TestProject.dll",
                PipelineTypeName     = PipelineType,
                SourceDir            = testContextInstance.TestDir + @"\..\..\BREPipelineFramework.UnitTests\Sample Files\Input Files",
                SearchPattern        = InputFileName,
                Destination          = testContextInstance.TestDir + @"\..\..\BREPipelineFramework.UnitTests\Sample Files\Output Files\Output.txt",
                OutputContextFile    = testContextInstance.TestDir + @"\..\..\BREPipelineFramework.UnitTests\Sample Files\Output Files\Context.xml",
            };

            if (!string.IsNullOrEmpty(InstanceConfigFilePath))
            {
                pipelineTestStep.InstanceConfigFile = InstanceConfigFilePath;
            }

            if (instanceConfigLoader != null)
            {
                pipelineTestStep.InstanceConfigLoader = instanceConfigLoader;
            }

            if (inputContextLoader != null)
            {
                pipelineTestStep.InputContextLoader = inputContextLoader;
            }

            var docSpecDefinition = new b.TestSteps.BizTalk.Pipeline.DocSpecDefinition();

            docSpecDefinition.AssemblyPath = @"..\..\..\BREPipelineFramework.TestProject\bin\debug\BREPipelineFramework.TestProject.dll";
            docSpecDefinition.TypeName     = "BREPipelineFramework.TestProject.Envelope";

            pipelineTestStep.DocSpecs.Add(docSpecDefinition);

            var docSpecDefinition1 = new b.TestSteps.BizTalk.Pipeline.DocSpecDefinition();

            docSpecDefinition1.AssemblyPath = @"..\..\..\BREPipelineFramework.TestProject\bin\debug\BREPipelineFramework.TestProject.dll";
            docSpecDefinition1.TypeName     = inputMessageType;

            pipelineTestStep.DocSpecs.Add(docSpecDefinition1);

            if (!string.IsNullOrEmpty(additionalInputType))
            {
                var docSpecDefinition2 = new b.TestSteps.BizTalk.Pipeline.DocSpecDefinition();

                docSpecDefinition2.AssemblyPath = @"..\..\..\BREPipelineFramework.TestProject\bin\debug\BREPipelineFramework.TestProject.dll";
                docSpecDefinition2.TypeName     = additionalInputType;

                pipelineTestStep.DocSpecs.Add(docSpecDefinition2);
            }

            if (!string.IsNullOrEmpty(yetAnotherInputType))
            {
                var docSpecDefinition3 = new b.TestSteps.BizTalk.Pipeline.DocSpecDefinition();

                docSpecDefinition3.AssemblyPath = @"..\..\..\BREPipelineFramework.TestProject\bin\debug\BREPipelineFramework.TestProject.dll";
                docSpecDefinition3.TypeName     = yetAnotherInputType;

                pipelineTestStep.DocSpecs.Add(docSpecDefinition3);
            }


            _BREPipelineFrameworkTest.ExecutionSteps.Add(pipelineTestStep);

            var fileReadMultipleStepContext = new b.TestSteps.File.FileReadMultipleStep
            {
                ExpectedNumberOfFiles = 1,
                DeleteFiles           = false,
                DirectoryPath         = testContextInstance.TestDir + @"\..\..\BREPipelineFramework.UnitTests\Sample Files\Output Files",
                SearchPattern         = "Context.xml",
                Timeout = 3000
            };

            var xmlValidateContextStep = new BREPipelineFramework.CustomBizUnitTestSteps.XmlValidationStep();

            foreach (KeyValuePair <string, string> pair in contextXPathCollection.XPathQueryList)
            {
                var xPathDefinitionPropertyValue = new BREPipelineFramework.CustomBizUnitTestSteps.XPathDefinition
                {
                    Description = "Property Value Test",
                    XPath       = pair.Key,
                    Value       = pair.Value
                };

                xmlValidateContextStep.XPathValidations.Add(xPathDefinitionPropertyValue);
            }

            fileReadMultipleStepContext.SubSteps.Add(xmlValidateContextStep);

            _BREPipelineFrameworkTest.ExecutionSteps.Add(fileReadMultipleStepContext);

            var bizUnit = new b.BizUnit(_BREPipelineFrameworkTest);

            return(bizUnit);
        }
Ejemplo n.º 17
0
 ///<summary>
 /// Used to save a TestCase to disc in Xaml format
 ///</summary>
 ///<param name="testCase">The TestCase to be saved to disc</param>
 ///<param name="filePath">The file path of the Xaml test case representaiton.</param>
 public static void SaveToFile(TestCase testCase, string filePath)
 {
     BizUnitSerializationHelper.SaveToFile(testCase, filePath);
 }