示例#1
0
        /// <summary>
        /// Loads the configurations from a saved profile.
        /// </summary>
        /// <param name="filename">File name</param>
        public void LoadProfileSettings(string filename, string testSuiteFolderBin)
        {
            using (ProfileUtil profile = ProfileUtil.LoadProfile(filename))
            {
                if (!profile.VerifyVersion(appConfig.TestSuiteName, appConfig.TestSuiteVersion))
                {
                    if (profile.Info != null)
                    {
                        throw new InvalidDataException(string.Format(
                                                           StringResource.ProfileNotMatchError,
                                                           profile.Info.TestSuiteName, profile.Info.Version,
                                                           appConfig.TestSuiteName, appConfig.TestSuiteVersion
                                                           ));
                    }
                    else
                    {
                        throw new InvalidDataException(StringResource.InvalidProfile);
                    }
                }

                ptfconfigDirectory = Path.Combine("PtfConfigDirectory", $"{appConfig.TestSuiteName}-{sessionStartTime.ToString("yyyy-MM-dd-HH-mm-ss")}");
                string desCfgDir = ptfconfigDirectory;
                profile.SavePtfCfgTo(desCfgDir, testSuiteFolderBin, appConfig.PipeName);
                filter.LoadProfile(profile.ProfileStream);
                ImportPlaylist(profile.PlaylistStream);

                SetSelectedCaseList(filter.FilterTestCaseList(testSuite.TestCaseList));

                int sel, notfound;
                ApplyPlaylist(out sel, out notfound);
            }
        }
        /// <summary>
        /// Loads the configurations from a saved profile.
        /// </summary>
        /// <param name="filename">File name</param>
        public void LoadProfileSettings(string filename)
        {
            using (ProfileUtil profile = ProfileUtil.LoadProfile(filename))
            {
                if (!profile.VerifyVersion(appConfig.TestSuiteName, appConfig.TestSuiteVersion))
                {
                    if (profile.Info != null)
                    {
                        throw new InvalidDataException(string.Format(
                                                           StringResource.ProfileNotMatchError,
                                                           profile.Info.TestSuiteName, profile.Info.Version,
                                                           appConfig.TestSuiteName, appConfig.TestSuiteVersion
                                                           ));
                    }
                    else
                    {
                        throw new InvalidDataException(StringResource.InvalidProfile);
                    }
                }
                string desCfgDir = System.IO.Path.Combine(appConfig.TestSuiteDirectory, "Bin");
                profile.SavePtfCfgTo(desCfgDir);
                filter.LoadProfile(profile.ProfileStream);
                ImportPlaylist(profile.PlaylistStream);
                GetSelectedCaseList();

                int sel, notfound;
                ApplyPlaylist(out sel, out notfound);
            }
        }