本文整理汇总了C#中IAssemblyInfo类的典型用法代码示例。如果您正苦于以下问题:C# IAssemblyInfo类的具体用法?C# IAssemblyInfo怎么用?C# IAssemblyInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IAssemblyInfo类属于命名空间,在下文中一共展示了IAssemblyInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAssemblyLoaders
public static IList<AssemblyLoaderAttribute> GetAssemblyLoaders(IAssemblyInfo assemblyInfo) {
return assemblyInfo.GetCustomAttributes(typeof(AssemblyLoaderAttribute))
.OfType<IReflectionAttributeInfo>()
.Select(ai => ai.Attribute)
.OfType<AssemblyLoaderAttribute>()
.ToList();
}
示例2: Initialize
void Initialize(ITestCollection testCollection, IAssemblyInfo assembly, ITypeInfo type, IMethodInfo method, IAttributeInfo factAttribute, object[] arguments)
{
string displayNameBase = factAttribute.GetNamedArgument<string>("DisplayName") ?? type.Name + "." + method.Name;
ITypeInfo[] resolvedTypes = null;
if (arguments != null && method.IsGenericMethodDefinition)
{
resolvedTypes = ResolveGenericTypes(method, arguments);
method = method.MakeGenericMethod(resolvedTypes);
}
Assembly = assembly;
Class = type;
Method = method;
Arguments = arguments;
DisplayName = GetDisplayNameWithArguments(displayNameBase, arguments, resolvedTypes);
SkipReason = factAttribute.GetNamedArgument<string>("Skip");
Traits = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase);
TestCollection = testCollection;
foreach (var traitAttribute in Method.GetCustomAttributes(typeof(ITraitAttribute))
.Concat(Class.GetCustomAttributes(typeof(ITraitAttribute))))
{
var discovererAttribute = traitAttribute.GetCustomAttributes(typeof(TraitDiscovererAttribute)).First();
var discoverer = ExtensibilityPointFactory.GetTraitDiscoverer(discovererAttribute);
if (discoverer != null)
foreach (var keyValuePair in discoverer.GetTraits(traitAttribute))
Traits.Add(keyValuePair.Key, keyValuePair.Value);
}
uniqueID = new Lazy<string>(GetUniqueID, true);
}
示例3: 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;
}
示例4: XunitTestFrameworkDiscoverer
/// <summary>
/// Initializes a new instance of the <see cref="XunitTestFrameworkDiscoverer"/> class.
/// </summary>
/// <param name="assemblyInfo">The test assembly.</param>
/// <param name="sourceProvider">The source information provider.</param>
public XunitTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo, ISourceInformationProvider sourceProvider = null)
{
Guard.ArgumentNotNull("assemblyInfo", assemblyInfo);
this.assemblyInfo = assemblyInfo;
this.sourceProvider = sourceProvider ?? new VisualStudioSourceInformationProvider();
}
示例5: GetAssemblyTest
private Test GetAssemblyTest(IAssemblyInfo assembly, Test parentTest, Version frameworkVersion, bool populateRecursively)
{
Test assemblyTest;
if (!assemblyTests.TryGetValue(assembly, out assemblyTest))
{
assemblyTest = CreateAssemblyTest(assembly);
String frameworkName = CONCORDION_ASSEMBLY_DISPLAY_NAME;
assemblyTest.Metadata.SetValue(MetadataKeys.Framework, frameworkName);
assemblyTest.Metadata.SetValue(MetadataKeys.File, assembly.Path);
assemblyTest.Kind = AssemblyKind;
parentTest.AddChild(assemblyTest);
assemblyTests.Add(assembly, assemblyTest);
}
GetInputOutputDirectories(assembly);
if (populateRecursively)
{
foreach (var type in assembly.GetExportedTypes())
TryGetTypeTest(type, assemblyTest);
}
return assemblyTest;
}
示例6: CSUnitAssemblyTest
/// <inheritdoc />
public CSUnitAssemblyTest(IAssemblyInfo assembly, string location)
: base(assembly.Name, assembly)
{
Kind = TestKinds.Assembly;
this.location = location;
}
示例7: 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;
}
示例8: ConvertConfigPaths
public static void ConvertConfigPaths(IAssemblyInfo assemblyInfo)
{
if (!string.IsNullOrWhiteSpace(assemblyInfo.AfterBuild))
{
assemblyInfo.AfterBuild = helper.ConvertPath(assemblyInfo.AfterBuild);
}
if (!string.IsNullOrWhiteSpace(assemblyInfo.BeforeBuild))
{
assemblyInfo.BeforeBuild = helper.ConvertPath(assemblyInfo.BeforeBuild);
}
if (!string.IsNullOrWhiteSpace(assemblyInfo.Output))
{
assemblyInfo.Output = helper.ConvertPath(assemblyInfo.Output);
}
if (!string.IsNullOrWhiteSpace(assemblyInfo.PluginsPath))
{
assemblyInfo.PluginsPath = helper.ConvertPath(assemblyInfo.PluginsPath);
}
if (!string.IsNullOrWhiteSpace(assemblyInfo.LocalesOutput))
{
assemblyInfo.LocalesOutput = helper.ConvertPath(assemblyInfo.LocalesOutput);
}
}
示例9: GetInternalVisibleToAttributes
private static IEnumerable<CustomAttribute> GetInternalVisibleToAttributes( IAssemblyInfo assemblyInfo )
{
var internalVisibleToAttributes = assemblyInfo.Assembly.CustomAttributes
.Where( t => t.AttributeType.FullName == AttributeFullName );
return internalVisibleToAttributes;
}
示例10: DecorateAssemblyTest
/// <inheritdoc />
protected override void DecorateAssemblyTest(IPatternScope assemblyScope, IAssemblyInfo assembly)
{
assemblyScope.TestBuilder.TestActions.InitializeTestChain.After(state =>
{
TestAssemblyExecutionParameters.DegreeOfParallelism = degreeOfParallelism;
});
}
示例11: NUnitReflectiveTestExplorerEngine
public NUnitReflectiveTestExplorerEngine(TestModel testModel, IAssemblyInfo assembly)
{
this.testModel = testModel;
this.assembly = assembly;
nunitFixtures = new List<NUnit.Core.TestSuite>();
}
示例12: 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)
{
var reflector = new NSpec.Domain.Reflector(assembly.Path);
var finder = new SpecFinder(reflector);
var builder = new ContextBuilder(finder, new DefaultConventions());
ContextCollection contexts = builder.Contexts();
contexts.Build();
contexts.Do(c => assemblyTest.AddChild(this.CreateGallioTestFrom(c)));
}
return assemblyTest;
}
示例13: GetTestFrameworkType
static Type GetTestFrameworkType(IAssemblyInfo testAssembly, IMessageSink diagnosticMessageSink)
{
try
{
var testFrameworkAttr = testAssembly.GetCustomAttributes(typeof(ITestFrameworkAttribute)).FirstOrDefault();
if (testFrameworkAttr != null)
{
var discovererAttr = testFrameworkAttr.GetCustomAttributes(typeof(TestFrameworkDiscovererAttribute)).FirstOrDefault();
if (discovererAttr != null)
{
var discoverer = ExtensibilityPointFactory.GetTestFrameworkTypeDiscoverer(diagnosticMessageSink, discovererAttr);
if (discoverer != null)
return discoverer.GetTestFrameworkType(testFrameworkAttr);
var ctorArgs = discovererAttr.GetConstructorArguments().ToArray();
diagnosticMessageSink.OnMessage(new DiagnosticMessage($"Unable to create custom test framework discoverer type '{ctorArgs[1]}, {ctorArgs[0]}'"));
}
else
{
diagnosticMessageSink.OnMessage(new DiagnosticMessage("Assembly-level test framework attribute was not decorated with [TestFrameworkDiscoverer]"));
}
}
}
catch (Exception ex)
{
diagnosticMessageSink.OnMessage(new DiagnosticMessage($"Exception thrown during test framework discoverer construction: {ex.Unwrap()}"));
}
return typeof(XunitTestFramework);
}
示例14: Xunit2Discoverer
Xunit2Discoverer(ISourceInformationProvider sourceInformationProvider,
IAssemblyInfo assemblyInfo,
string assemblyFileName,
string xunitExecutionAssemblyPath,
string configFileName,
bool shadowCopy,
string shadowCopyFolder,
IMessageSink diagnosticMessageSink)
{
Guard.ArgumentNotNull("assemblyInfo", (object)assemblyInfo ?? assemblyFileName);
Guard.FileExists("xunitExecutionAssemblyPath", xunitExecutionAssemblyPath);
DiagnosticMessageSink = diagnosticMessageSink ?? new NullMessageSink();
appDomain = new RemoteAppDomainManager(assemblyFileName ?? xunitExecutionAssemblyPath, configFileName, shadowCopy, shadowCopyFolder);
var testFrameworkAssemblyName = GetTestFrameworkAssemblyName(xunitExecutionAssemblyPath);
// If we didn't get an assemblyInfo object, we can leverage the reflection-based IAssemblyInfo wrapper
if (assemblyInfo == null)
assemblyInfo = appDomain.CreateObject<IAssemblyInfo>(testFrameworkAssemblyName, "Xunit.Sdk.ReflectionAssemblyInfo", assemblyFileName);
framework = appDomain.CreateObject<ITestFramework>(testFrameworkAssemblyName, "Xunit.Sdk.TestFrameworkProxy", assemblyInfo, sourceInformationProvider, DiagnosticMessageSink);
discoverer = Framework.GetDiscoverer(assemblyInfo);
}
示例15: Xunit2Discoverer
Xunit2Discoverer(AppDomainSupport appDomainSupport,
ISourceInformationProvider sourceInformationProvider,
IAssemblyInfo assemblyInfo,
string assemblyFileName,
string xunitExecutionAssemblyPath,
string configFileName,
bool shadowCopy,
string shadowCopyFolder,
IMessageSink diagnosticMessageSink,
bool verifyAssembliesOnDisk)
{
Guard.ArgumentNotNull("assemblyInfo", (object)assemblyInfo ?? assemblyFileName);
if (verifyAssembliesOnDisk)
Guard.FileExists("xunitExecutionAssemblyPath", xunitExecutionAssemblyPath);
#if PLATFORM_DOTNET
CanUseAppDomains = false;
#else
CanUseAppDomains = !IsDotNet(xunitExecutionAssemblyPath);
#endif
DiagnosticMessageSink = diagnosticMessageSink ?? new NullMessageSink();
var appDomainAssembly = assemblyFileName ?? xunitExecutionAssemblyPath;
appDomain = AppDomainManagerFactory.Create(appDomainSupport != AppDomainSupport.Denied && CanUseAppDomains, appDomainAssembly, configFileName, shadowCopy, shadowCopyFolder);
var testFrameworkAssemblyName = GetTestFrameworkAssemblyName(xunitExecutionAssemblyPath);
// If we didn't get an assemblyInfo object, we can leverage the reflection-based IAssemblyInfo wrapper
if (assemblyInfo == null)
assemblyInfo = appDomain.CreateObject<IAssemblyInfo>(testFrameworkAssemblyName, "Xunit.Sdk.ReflectionAssemblyInfo", assemblyFileName);
framework = appDomain.CreateObject<ITestFramework>(testFrameworkAssemblyName, "Xunit.Sdk.TestFrameworkProxy", assemblyInfo, sourceInformationProvider, DiagnosticMessageSink);
discoverer = Framework.GetDiscoverer(assemblyInfo);
}