本文整理汇总了C#中IAssemblyInfo.Resolve方法的典型用法代码示例。如果您正苦于以下问题:C# IAssemblyInfo.Resolve方法的具体用法?C# IAssemblyInfo.Resolve怎么用?C# IAssemblyInfo.Resolve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAssemblyInfo
的用法示例。
在下文中一共展示了IAssemblyInfo.Resolve方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAssemblyTest
Test GetAssemblyTest(IAssemblyInfo assembly, Test parentTest, Version frameworkVersion, bool populateRecursively)
{
MachineAssemblyTest assemblyTest;
if (!assemblyTests.TryGetValue(assembly, out assemblyTest))
{
assemblyTest = new MachineAssemblyTest(assembly.Name, assembly, frameworkVersion);
assemblyTest.Kind = TestKinds.Assembly;
ModelUtils.PopulateMetadataFromAssembly(assembly, assemblyTest.Metadata);
string frameworkName = String.Format("Machine Specifications v{0}", frameworkVersion);
assemblyTest.Metadata.SetValue(MetadataKeys.Framework, frameworkName);
assemblyTest.Metadata.SetValue(MetadataKeys.File, assembly.Path);
assemblyTest.Kind = TestKinds.Assembly;
parentTest.AddChild(assemblyTest);
assemblyTests.Add(assembly, assemblyTest);
}
if (populateRecursively)
{
AssemblyExplorer explorer = new AssemblyExplorer();
Assembly resolvedAssembly = assembly.Resolve(false);
assemblyTest.AssemblyContexts = explorer.FindAssemblyContextsIn( resolvedAssembly).ToList();
assemblyTest.GlobalCleanup = explorer.FindAssemblyWideContextCleanupsIn(resolvedAssembly).ToList();
assemblyTest.SpecificationSupplements = explorer.FindSpecificationSupplementsIn(resolvedAssembly).ToList();
explorer.FindContextsIn(resolvedAssembly)
.Select( context => GetContextTest( context))
.Each( test => assemblyTest.AddChild( test));
}
return assemblyTest;
}
示例2: GetAssemblyTest
private Test GetAssemblyTest(IAssemblyInfo assembly, Test parentTest, Version frameworkVersion)
{
Test assemblyTest;
if (assemblyTests.TryGetValue(assembly, out assemblyTest))
return assemblyTest;
try
{
Assembly loadedAssembly = assembly.Resolve(false);
if (Reflector.IsUnresolved(loadedAssembly))
assemblyTest = BuildAssemblyTest_Reflective(assembly);
else
assemblyTest = BuildAssemblyTest_Native(assembly, loadedAssembly.Location);
string frameworkName = String.Format(Resources.CSUnitTestExplorer_FrameworkNameWithVersionFormat, frameworkVersion);
assemblyTest.Metadata.SetValue(MetadataKeys.Framework, frameworkName);
assemblyTest.Metadata.SetValue(MetadataKeys.File, assembly.Path);
assemblyTest.Kind = AssemblyKind;
}
catch (Exception ex)
{
TestModel.AddAnnotation(new Annotation(AnnotationType.Error, assembly,
"An exception was thrown while exploring a csUnit test assembly.", ex));
return null;
}
if (assemblyTest != null)
{
parentTest.AddChild(assemblyTest);
assemblyTests.Add(assembly, assemblyTest);
}
return assemblyTest;
}
示例3: GetInputOutputDirectories
private void GetInputOutputDirectories(IAssemblyInfo assembly)
{
var config = new SpecificationConfig().Load(assembly.Resolve(false));
var baseInputDirectoryInfo = new DirectoryInfo(config.BaseInputDirectory);
if (baseInputDirectoryInfo.Exists)
{
}
else
{
TestModel.AddAnnotation(new Annotation(AnnotationType.Error, assembly, String.Format("The Base Input Directory {0} does not exist, reverting to default", config.BaseInputDirectory)));
}
var baseOutputDirectoryInfo = new DirectoryInfo(config.BaseOutputDirectory);
this._baseOutputDirectory = baseOutputDirectoryInfo;
if (!_baseOutputDirectory.Exists)
{
Directory.CreateDirectory(_baseOutputDirectory.FullName);
}
}
示例4: GetAssemblyTest
Test GetAssemblyTest( IAssemblyInfo assembly, Test parentTest, Version frameworkVersion, bool populateRecursively )
{
NSpecAssemblyTest assemblyTest;
if( !assemblyTests.TryGetValue( assembly, out assemblyTest ) )
{
assemblyTest = new NSpecAssemblyTest( assembly.Name, assembly, frameworkVersion );
assemblyTest.Kind = TestKinds.Assembly;
ModelUtils.PopulateMetadataFromAssembly( assembly, assemblyTest.Metadata );
string frameworkName = String.Format( "NSpec v{0}", frameworkVersion );
assemblyTest.Metadata.SetValue( MetadataKeys.Framework, frameworkName );
assemblyTest.Metadata.SetValue( MetadataKeys.File, assembly.Path );
assemblyTest.Kind = TestKinds.Assembly;
parentTest.AddChild( assemblyTest );
assemblyTests.Add( assembly, assemblyTest );
}
if( populateRecursively )
{
Assembly resolvedAssembly = assembly.Resolve( false );
var finder = new SpecFinder( resolvedAssembly, new NSpec.Domain.Reflector() );
var builder = new ContextBuilder( finder, new DefaultConventions() );
ContextCollection contexts = builder.Contexts();
contexts.Build();
contexts.Do( c => assemblyTest.AddChild( this.CreateGallioTestFrom( c ) ) );
}
return assemblyTest;
}