本文整理汇总了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;
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}