当前位置: 首页>>代码示例>>C#>>正文


C# TestPackage.AddSubPackage方法代码示例

本文整理汇总了C#中TestPackage.AddSubPackage方法的典型用法代码示例。如果您正苦于以下问题:C# TestPackage.AddSubPackage方法的具体用法?C# TestPackage.AddSubPackage怎么用?C# TestPackage.AddSubPackage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestPackage的用法示例。


在下文中一共展示了TestPackage.AddSubPackage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExpandProjectPackage

        /// <summary>
        /// Expands a TestPackage based on a known project format, populating it
        /// with the project contents and any settings the project provides. 
        /// Note that the package file path must be checked to ensure that it is
        /// a known project format before calling this method.
        /// </summary>
        /// <param name="package">The TestPackage to be expanded</param>
        public void ExpandProjectPackage(TestPackage package)
        {
            Guard.ArgumentNotNull(package, "package");
            Guard.ArgumentValid(package.SubPackages.Count == 0, "Package is already expanded", "package");

            string path = package.FullName;
            if (!File.Exists(path))
                return;

            IProject project = LoadFrom(path);
            Guard.ArgumentValid(project != null, "Unable to load project " + path, "package");

            string configName = package.GetSetting(EnginePackageSettings.ActiveConfig, (string)null); // Need RunnerSetting
            TestPackage tempPackage = project.GetTestPackage(configName);

            // The original package held overrides, so don't change them, but
            // do apply any settings specified within the project itself.
            foreach (string key in tempPackage.Settings.Keys)
                if (!package.Settings.ContainsKey(key)) // Don't override settings from command line
                    package.Settings[key] = tempPackage.Settings[key];

            foreach (var subPackage in tempPackage.SubPackages)
                package.AddSubPackage(subPackage);

            // If no config is specified (by user or by the proejct loader) check
            // to see if one exists in same directory as the package. If so, we
            // use it. If not, each assembly will use it's own config, if present.
            if (!package.Settings.ContainsKey(EnginePackageSettings.ConfigurationFile))
            {
                var packageConfig = Path.ChangeExtension(path, ".config");
                if (File.Exists(packageConfig))
                    package.Settings[EnginePackageSettings.ConfigurationFile] = packageConfig;
            }
        }
开发者ID:ChrisMaddock,项目名称:nunit,代码行数:41,代码来源:ProjectService.cs

示例2: ExpandProjectPackage

        /// <summary>
        /// Expands a TestPackage based on a known project format, populating it
        /// with the project contents and any settings the project provides. 
        /// Note that the package file path must be checked to ensure that it is
        /// a known project format before calling this method.
        /// </summary>
        /// <param name="package">The TestPackage to be expanded</param>
        public void ExpandProjectPackage(TestPackage package)
        {
            Guard.ArgumentNotNull(package, "package");
            Guard.ArgumentValid(package.SubPackages.Count == 0, "Package is already expanded", "package");

            string path = package.FullName;
            IProject project = LoadFrom(path);
            Guard.ArgumentValid(project != null, "Unable to load project " + path, "package");

            string configName = package.GetSetting(PackageSettings.ActiveConfig, (string)null); // Need RunnerSetting
            TestPackage tempPackage = project.GetTestPackage(configName);

            // The original package held overrides, so don't change them, but
            // do apply any settings specified within the project itself.
            foreach (string key in tempPackage.Settings.Keys)
                if (!package.Settings.ContainsKey(key)) // Don't override settings from command line
                    package.Settings[key] = tempPackage.Settings[key];

            foreach (var subPackage in tempPackage.SubPackages)
                package.AddSubPackage(subPackage);
        }
开发者ID:rojac07,项目名称:nunit,代码行数:28,代码来源:ProjectService.cs

示例3: GetTestPackage

        public TestPackage GetTestPackage(string configName)
        {
            var package = new TestPackage(ProjectPath);

            foreach (var name in _configs.Keys)
            {
                if (configName == null || configName == name)
                {
                    var config = _configs[name];
                    foreach (string assembly in config.Assemblies)
                    {
                        package.AddSubPackage(new TestPackage(assembly));
                    }
                    break;
                }
            }

            return package;
        }
开发者ID:alfeg,项目名称:nunit,代码行数:19,代码来源:VSSolution.cs

示例4: GetTestPackage

        public TestPackage GetTestPackage(string configName)
        {
            TestPackage package = new TestPackage(ProjectPath);

            string appbase = null;
            foreach (var name in _configs.Keys)
            {
                if (configName == null || configName == name)
                {
                    var config = _configs[name];
                    package.AddSubPackage(new TestPackage(config.AssemblyPath));
                    appbase = config.OutputDirectory;
                    break;
                }
            }

            if (appbase != null)
                package.AddSetting("BasePath", appbase);

            return package;
        }
开发者ID:alfeg,项目名称:nunit,代码行数:21,代码来源:VSProject.cs

示例5: GetTestPackage

        public TestPackage GetTestPackage(string configName)
        {
            var package = new TestPackage(ProjectPath);
            if (configName == null)
                configName = ActiveConfigName;

            if (configName != null)
            {
                XmlNode configNode = GetConfigNode(configName);
                
                string basePath = GetBasePathForConfig(configNode);

                foreach (XmlNode node in configNode.SelectNodes("assembly"))
                {
                    string assembly = node.GetAttribute("path");
                    if (basePath != null)
                        assembly = Path.Combine(basePath, assembly);
                    package.AddSubPackage(new TestPackage(assembly));
                }

                var settings = GetSettingsForConfig(configNode);
                foreach (var key in settings.Keys)
                    package.Settings.Add(key, settings[key]);
            }

            return package;
        }
开发者ID:alfeg,项目名称:nunit,代码行数:27,代码来源:NUnitProject.cs


注:本文中的TestPackage.AddSubPackage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。