Ejemplo n.º 1
0
        /// <summary>
        /// Executes demo live tests with main package that has a parameter.
        /// </summary>
        internal static void RunLiveTests4()
        {
            // set package execution parameters eg. variables, connections
            var parameters = new ExecutionParameters();

            // add variables and their values to be set when the package has been loaded
            parameters.AddVariable(@"\[MainWithParameter].[ConnectionString]", Constants.SsisDbConnectionString);
            parameters.AddVariable(@"\[MainWithParameter].[CopyCustomersPath]", Constants.PathToCopyCustomersPackage);
            parameters.AddVariable(@"\[MainWithParameter].[LoadCustomersPath]", Constants.PathToLoadCustomersPackage);
            parameters.AddVariable(@"\[MainWithParameter].[ConvertDestinationPath]", Constants.CustomersFileConverted);
            parameters.AddVariable(@"\[MainWithParameter].[DestinationPath]", Constants.CustomersFileDestination);

            // add  package parameters
            parameters.AddPackageParameter(@"SourcePath", Constants.CustomersFileSource);

            // create engine for live testing
            var engine = EngineFactory.GetClassInstance <ILiveTestEngine>();

            // load packages and relate them to the logical group - repository
            engine.LoadPackages("DEMO", Constants.PathToPackages);

            // load live tests from the current assembly
            engine.LoadRepositoryActions("DEMO");

            // set execution parameters
            engine.SetExecutionParameters(parameters);

            // execute the package and attach live tests
            engine.ExecuteLiveTestsWithGui("DEMO", "MainWithParameter.dtsx");
        }