/// <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(); }
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; }
/// <inheritdoc /> protected override void DecorateAssemblyTest(IPatternScope assemblyScope, IAssemblyInfo assembly) { assemblyScope.TestBuilder.TestActions.InitializeTestChain.After(state => { TestAssemblyExecutionParameters.DegreeOfParallelism = degreeOfParallelism; }); }
public static IList<AssemblyLoaderAttribute> GetAssemblyLoaders(IAssemblyInfo assemblyInfo) { return assemblyInfo.GetCustomAttributes(typeof(AssemblyLoaderAttribute)) .OfType<IReflectionAttributeInfo>() .Select(ai => ai.Attribute) .OfType<AssemblyLoaderAttribute>() .ToList(); }
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); }
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); }
public KuduXunitTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo, ISourceInformationProvider sourceProvider, IMessageSink diagnosticMessageSink, IXunitTestCollectionFactory collectionFactory = null) : base(assemblyInfo, sourceProvider, diagnosticMessageSink, collectionFactory) { }
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; }
public NUnitReflectiveTestExplorerEngine(TestModel testModel, IAssemblyInfo assembly) { this.testModel = testModel; this.assembly = assembly; nunitFixtures = new List<NUnit.Core.TestSuite>(); }
/// <summary> /// Initializes a new instance of the <see cref="TestAssembly"/> class. /// </summary> /// <param name="assembly">The test assembly.</param> /// <param name="configFileName">The optional configuration filename (defaults to the /// configuration file of the current app domain if not provided)</param> /// <param name="version">The version number of the assembly (defaults to "0.0.0.0")</param> public TestAssembly(IAssemblyInfo assembly, string configFileName = null, Version version = null) { Guard.ArgumentNotNull("assembly", assembly); Assembly = assembly; ConfigFileName = configFileName; Version = version; #if !ANDROID && !__IOS__ && ! __UNIFIED__ if (Version == null) { var reflectionAssembly = assembly as IReflectionAssemblyInfo; if (reflectionAssembly != null) Version = reflectionAssembly.Assembly.GetName().Version; } #endif if (Version == null) Version = new Version(0, 0, 0, 0); #if !WINDOWS_PHONE_APP && !WINDOWS_PHONE && !DOTNETCORE if (ConfigFileName == null) ConfigFileName = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; #endif }
/// <inheritdoc /> protected override void DecorateAssemblyTest(IPatternScope assemblyScope, IAssemblyInfo assembly) { assemblyScope.TestBuilder.TestActions.InitializeTestChain.After(state => { TestAssemblyExecutionParameters.DefaultTestCaseTimeout = Timeout; }); }
public static IPlugins GetPlugins(ITranslator translator, IAssemblyInfo config) { string path = null; if (!string.IsNullOrWhiteSpace(config.PluginsPath)) { path = Path.Combine(translator.FolderMode ? translator.Location : Path.GetDirectoryName(translator.Location), config.PluginsPath); } else { path = Path.Combine(translator.FolderMode ? translator.Location : Path.GetDirectoryName(translator.Location), "Bridge" + Path.DirectorySeparatorChar + "plugins"); } if (!System.IO.Directory.Exists(path)) { return new Plugins() { plugins = new IPlugin[0] }; } DirectoryCatalog dirCatalog = new DirectoryCatalog(path, "*.dll"); var catalog = new AggregateCatalog(dirCatalog); CompositionContainer container = new CompositionContainer(catalog); var plugins = new Plugins(); container.ComposeParts(plugins); return plugins; }
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 (IAttributeInfo traitAttribute in Method.GetCustomAttributes(typeof(TraitAttribute)) .Concat(Class.GetCustomAttributes(typeof(TraitAttribute)))) { var ctorArgs = traitAttribute.GetConstructorArguments().ToList(); Traits.Add((string)ctorArgs[0], (string)ctorArgs[1]); } uniqueID = new Lazy<string>(GetUniqueID, true); }
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); }
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); }
public CulturedXunitTestCase(ITestCollection testCollection, IAssemblyInfo assembly, ITypeInfo type, IMethodInfo method, IAttributeInfo factAttribute, string culture) : base(testCollection, assembly, type, method, factAttribute) { this.culture = culture; Traits.Add("Culture", culture); }
/// <summary> /// Gets the test collection definitions for the given assembly. /// </summary> /// <param name="assemblyInfo">The assembly.</param> /// <param name="messageAggregator">The message aggregator.</param> /// <returns>A list of mappings from test collection name to test collection definitions (as <see cref="ITypeInfo"/></returns> public static Dictionary<string, ITypeInfo> GetTestCollectionDefinitions(IAssemblyInfo assemblyInfo, IMessageAggregator messageAggregator) { var attributeTypesByName = assemblyInfo.GetTypes(false) .Select(type => new { Type = type, Attribute = type.GetCustomAttributes(typeof(CollectionDefinitionAttribute).AssemblyQualifiedName).FirstOrDefault() }) .Where(list => list.Attribute != null) .GroupBy(list => (string)list.Attribute.GetConstructorArguments().Single(), list => list.Type, StringComparer.OrdinalIgnoreCase); var result = new Dictionary<string, ITypeInfo>(); foreach (var grouping in attributeTypesByName) { var types = grouping.ToList(); result[grouping.Key] = types[0]; if (types.Count > 1) messageAggregator.Add(new EnvironmentalWarning { Message = String.Format("Multiple test collections declared with name '{0}': {1}", grouping.Key, String.Join(", ", types.Select(type => type.Name))) }); } return result; }
Xunit2Discoverer(ISourceInformationProvider sourceInformationProvider, IAssemblyInfo assemblyInfo, string assemblyFileName, string xunitExecutionAssemblyPath, string configFileName, bool shadowCopy, string shadowCopyFolder) { Guard.ArgumentNotNull("assemblyInfo", (object)assemblyInfo ?? assemblyFileName); #if !ANDROID Guard.ArgumentValid("xunitExecutionAssemblyPath", "File not found: " + xunitExecutionAssemblyPath, File.Exists(xunitExecutionAssemblyPath)); #endif appDomain = new RemoteAppDomainManager(assemblyFileName ?? xunitExecutionAssemblyPath, configFileName, shadowCopy, shadowCopyFolder); #if !ANDROID var name = AssemblyName.GetAssemblyName(xunitExecutionAssemblyPath); var testFrameworkAssemblyName = name.FullName; #else var name = Assembly.Load(xunitExecutionAssemblyPath); var testFrameworkAssemblyName = name.FullName; #endif // 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); discoverer = Framework.GetDiscoverer(assemblyInfo); }
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; }
private static IEnumerable<CustomAttribute> GetInternalVisibleToAttributes( IAssemblyInfo assemblyInfo ) { var internalVisibleToAttributes = assemblyInfo.Assembly.CustomAttributes .Where( t => t.AttributeType.FullName == AttributeFullName ); return internalVisibleToAttributes; }
/// <summary> /// Creates an NUnit assembly-level test. /// </summary> /// <param name="assembly">The assembly.</param> /// <param name="runner">The NUnit test runner.</param> public NUnitAssemblyTest(IAssemblyInfo assembly, NUnit.Core.TestRunner runner) : base(assembly.Name, assembly, runner.Test) { Kind = TestKinds.Assembly; this.runner = runner; }
/// <inheritdoc /> public CSUnitAssemblyTest(IAssemblyInfo assembly, string location) : base(assembly.Name, assembly) { Kind = TestKinds.Assembly; this.location = location; }
/// <summary> /// Initializes a new instance of the <see cref="XunitTestFrameworkExecutor"/> class. /// </summary> /// <param name="assemblyFileName">Path of the test assembly.</param> public XunitTestFrameworkExecutor(string assemblyFileName) { this.assemblyFileName = assemblyFileName; var assembly = Assembly.Load(AssemblyName.GetAssemblyName(assemblyFileName)); assemblyInfo = Reflector.Wrap(assembly); }
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); } }
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; }
public PerfTestDiscoverer( IAssemblyInfo assemblyInfo, ISourceInformationProvider sourceProvider, IMessageSink diagnosticMessageSink) : base(assemblyInfo, sourceProvider, diagnosticMessageSink) { _testConfig = new TestConfig(); }
/// <summary> /// Initializes a new instance of the <see cref="XunitTestFrameworkExecutor"/> class. /// </summary> /// <param name="assemblyName">Name of the test assembly.</param> /// <param name="sourceInformationProvider">The source line number information provider.</param> public XunitTestFrameworkExecutor(AssemblyName assemblyName, ISourceInformationProvider sourceInformationProvider) { this.sourceInformationProvider = sourceInformationProvider; var assembly = Assembly.Load(assemblyName); assemblyInfo = Reflector.Wrap(assembly); assemblyFileName = assemblyInfo.AssemblyPath; }
public static void CreateConfig(IAssemblyInfo bridgeConfig, string folder) { using (var textFile = File.CreateText(folder + Path.DirectorySeparatorChar + CONFIG_FILE_NAME)) { var config = JsonConvert.SerializeObject(bridgeConfig); textFile.Write(config); } }
/// <summary> /// Initializes a new instance of the <see cref="DocumentedAssembly"/> class. /// </summary> /// <param name="info">The assembly information.</param> /// <param name="namespaces">The namespaces.</param> public DocumentedAssembly(IAssemblyInfo info, IEnumerable<DocumentedNamespace> namespaces) : base(MemberClassification.Assembly, null, null, null) { _definition = info.Definition; _identity = info.Identity; _name = GetAssemblyName(info); _namespaces = new List<DocumentedNamespace>(namespaces); }
/// <summary> /// Initializes a new instance of the <see cref="XunitTestFrameworkExecutor"/> class. /// </summary> /// <param name="assemblyFileName">Path of the test assembly.</param> /// <param name="sourceInformationProvider">The source line number information provider.</param> public XunitTestFrameworkExecutor(string assemblyFileName, ISourceInformationProvider sourceInformationProvider) { this.assemblyFileName = assemblyFileName; this.sourceInformationProvider = sourceInformationProvider; var assembly = Assembly.Load(AssemblyName.GetAssemblyName(assemblyFileName)); assemblyInfo = Reflector.Wrap(assembly); }
//readonly CollectionPerClassTestCollectionFactory testCollectionFactory; public ObservationDiscoverer(IAssemblyInfo assemblyInfo, ISourceInformationProvider sourceProvider, IMessageSink diagnosticMessageSink) : base(assemblyInfo, sourceProvider, diagnosticMessageSink) { //var testAssembly = new TestAssembly(assemblyInfo, AppDomain.CurrentDomain.SetupInformation.ConfigurationFile); //testCollectionFactory = new CollectionPerClassTestCollectionFactory(testAssembly, diagnosticMessageSink); //_xunitDiscoverer = new XunitTestFrameworkDiscoverer(assemblyInfo, sourceProvider, diagnosticMessageSink, testCollectionFactory); }
public void Add(IAssemblyInfo assemblyInfo) { _lock.EnterWriteLock(); if (!_descriptions.ContainsKey(assemblyInfo.AssemblyName) && !_refAssemblyInfos.ContainsKey(assemblyInfo.AssemblyName)) { _refAssemblyInfos.Add(assemblyInfo.AssemblyName, assemblyInfo); } _lock.ExitWriteLock(); }
public Inspector(IAssemblyInfo config = null) { Types = new List <ITypeInfo>(); IgnoredTypes = new List <string>(); AssemblyInfo = config ?? new AssemblyInfo(); Emitter = new TempEmitter { AssemblyInfo = AssemblyInfo }; }
internal ServiceInfo(string serviceFullName, IAssemblyInfo assemblyInfo, IServiceInfo generalization = null) { Debug.Assert(!String.IsNullOrEmpty(serviceFullName)); Debug.Assert(assemblyInfo != null); _serviceFullName = serviceFullName; _assemblyInfo = assemblyInfo; _generalization = generalization; _implementations = new CKObservableSortedArrayList <PluginInfo>((a, b) => CaseInsensitiveComparer.Default.Compare(a.PluginFullName, b.PluginFullName), false); }
public Inspector(IAssemblyInfo config = null) { this.Types = new List <ITypeInfo>(); this.IgnoredTypes = new List <string>(); this.AssemblyInfo = config ?? new AssemblyInfo(); this.Emitter = new TempEmitter { AssemblyInfo = this.AssemblyInfo }; }
public void Deserialize(IXunitSerializationInfo data) { string assemblyName = data.GetValue <string>("OrigAssembly"); originalAssemblyInfo = Reflector.Wrap(Assembly.LoadFrom(assemblyName)); //var an = new AssemblyName(assemblyName); //var assembly = Assembly.Load(new AssemblyName { Name = an.Name, Version = an.Version }); //originalAssemblyInfo = Reflector.Wrap(assembly); }
// Update the contents of the Modules tab page. private void _update_modules(IAssemblyInfo ai) { Trace.WriteLine("Updating Module Information."); m_modules.Items.Clear(); foreach (ModuleInfo m in ai.ReferencedModules) { Trace.WriteLine(" Module: " + m.Name); m_modules.Items.Add(new ListViewItem(m.Name)); } }
// Update the contents of the property panel to reflect the contents // of ``ai''. public void Display(IAssemblyInfo ai) { Debug.Assert(ai.GetAssembly() != null, "This infopanel doens't display error information."); AssemblyName an = ai.GetAssembly().GetName(); _update_assembly_name(an); _update_ref_assemblies(ai); _update_modules(ai); }
private static Test CreateAssemblyTest(IAssemblyInfo assembly, Version frameworkVersion) { MSTestAssembly assemblyTest = new MSTestAssembly(assembly.Name, assembly, frameworkVersion); assemblyTest.Kind = TestKinds.Assembly; ModelUtils.PopulateMetadataFromAssembly(assembly, assemblyTest.Metadata); return(assemblyTest); }
public TouTvChannel(ILogManager logManager, IHttpClient httpClient, IJsonSerializer jsonSerializer, IAssemblyInfo assemblyInfo) { _logger = logManager.GetLogger(GetType().Name); var presentationService = new PresentationService(httpClient, jsonSerializer); var mediaValidationV1Service = new MediaValidationV1Service(httpClient, jsonSerializer); _touTvProvider = new TouTvProvider(presentationService, mediaValidationV1Service); _assemblyInfo = assemblyInfo; }
/// <summary> /// Initializes a new instance of the <see cref="Xunit2Discoverer"/> class. /// </summary> /// <param name="appDomainSupport">Determines whether tests should be run in a separate app domain.</param> /// <param name="sourceInformationProvider">The source code information provider.</param> /// <param name="assemblyInfo">The assembly to use for discovery</param> /// <param name="xunitExecutionAssemblyPath">The path on disk of xunit.execution.dll; if <c>null</c>, then /// the location of xunit.execution.dll is implied based on the location of the test assembly</param> /// <param name="shadowCopyFolder">The path on disk to use for shadow copying; if <c>null</c>, a folder /// will be automatically (randomly) generated</param> /// <param name="diagnosticMessageSink">The message sink which received <see cref="IDiagnosticMessage"/> messages.</param> /// <param name="verifyAssembliesOnDisk">Determines whether or not to check for the existence of assembly files.</param> public Xunit2Discoverer(AppDomainSupport appDomainSupport, ISourceInformationProvider sourceInformationProvider, IAssemblyInfo assemblyInfo, string xunitExecutionAssemblyPath = null, string shadowCopyFolder = null, IMessageSink diagnosticMessageSink = null, bool verifyAssembliesOnDisk = true) : this(appDomainSupport, sourceInformationProvider, assemblyInfo, null, xunitExecutionAssemblyPath ?? GetXunitExecutionAssemblyPath(appDomainSupport, assemblyInfo), null, true, shadowCopyFolder, diagnosticMessageSink, verifyAssembliesOnDisk) { }
protected TestableXunitTestFrameworkDiscoverer( IAssemblyInfo assembly, ISourceInformationProvider sourceProvider, IMessageSink diagnosticMessageSink, IXunitTestCollectionFactory collectionFactory) : base(assembly, sourceProvider ?? Substitute.For <ISourceInformationProvider>(), diagnosticMessageSink ?? new Xunit.NullMessageSink(), collectionFactory) { Assembly = assembly; Sink = new TestDiscoverySink(); }
public ElasticTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo, ISourceInformationProvider sourceProvider, IMessageSink diagnosticMessageSink, IXunitTestCollectionFactory collectionFactory = null) : base( assemblyInfo, sourceProvider, diagnosticMessageSink, collectionFactory) { var a = Assembly.Load(new AssemblyName(assemblyInfo.Name)); var options = a.GetCustomAttribute <ElasticXunitConfigurationAttribute>()?.Options ?? new ElasticXunitRunOptions(); Options = options; }
private static IXunitTestCase[] TestCases(IAssemblyInfo assemblyInfo) { using var discoverySink = new TestDiscoverySink(); using var discoverer = new XunitTestFrameworkDiscoverer(assemblyInfo, SourceInformationProvider, DiagnosticMessageSink); discoverer.Find(false, discoverySink, TestFrameworkOptions.ForDiscovery()); discoverySink.Finished.WaitOne(); return(discoverySink.TestCases.Cast <IXunitTestCase>().ToArray()); }
public void GetTypesIncludesNestedTypes() { Assembly assembly = typeof(ReflectionPolicySample).Assembly; IAssemblyInfo info = GetAssembly(assembly); ITypeInfo expectedType = GetType(typeof(ReflectionPolicySample.Class1)); IList <ITypeInfo> types = info.GetTypes(); Assert.IsTrue(types.Contains(expectedType)); }
// Update the contents of the Assemblies tab page. private void _update_ref_assemblies(IAssemblyInfo ai) { Trace.WriteLine("Updating Assembly Information."); m_refasm.Items.Clear(); foreach (AssemblyName an in ai.ReferencedAssemblies) { string s = an.FullName; Trace.WriteLine(" Assembly: " + s); m_refasm.Items.Add(new ListViewItem(s)); } }
public Startup( IBatchDrivenInterfaceManager batchDrivenInterfaceManager, IEventDrivenInterfaceManager eventDrivenInterfaceManager, IFileSystem fileSystem, IAssemblyInfo assemblyInfo) { _batchDrivenInterfaceManager = batchDrivenInterfaceManager; _eventDrivenInterfaceManager = eventDrivenInterfaceManager; _fileSystem = fileSystem; _assemblyInfo = assemblyInfo; }
public void LoadPlugins(IPluginHost host, string path) { List <string> dllFileNames = new List <string>(); if (Directory.Exists(path)) { dllFileNames.AddRange(Directory.GetFiles(path, "plugin.*.dll")); dllFileNames.AddRange(Directory.GetFiles(path, "*.plugin.*.dll")); List <Assembly> assemblies = new List <Assembly>(); foreach (string dllFile in dllFileNames) { Assembly assembly = AppDomain.CurrentDomain.Load(AssemblyName.GetAssemblyName(dllFile)); //this is need to have Singletons shared!!!! assemblies.Add(assembly); } Type pluginType = typeof(IPlugin); List <Type> pluginTypes = new List <Type>(); foreach (Assembly assembly in assemblies) { if (assembly != null) { string nameSpace = getNamespace(assembly); Type typeInfo = assembly.GetType(nameSpace + ".AssemblyInfo"); if (typeInfo != null) { IAssemblyInfo info = (IAssemblyInfo)Activator.CreateInstance(typeInfo); foreach (string name in info.Plugins) { Type typePlugin = assembly.GetType(name); if (typePlugin != null) { pluginTypes.Add(typePlugin); } } } } } foreach (Type type in pluginTypes) { IPlugin plugin = (IPlugin)Activator.CreateInstance(type); plugin.init(); Dictionary <Guid, xwcs.core.controls.VisualControlInfo> controls = plugin.Info.Controls; //Very important: one plugin can have more guids (controls). Thatsway we have dictionary(std:map) : guid->plugin. It means more guid may handle to one plugin !!! foreach (xwcs.core.controls.VisualControlInfo info in controls.Values) { _plugins.Add(info.GUID, plugin); } } } }
/// <inheritdoc /> public override IEnumerable <ToolInfo> GetReferencedTools(IAssemblyInfo assembly) { AssemblyName frameworkAssemblyName = ReflectionUtils.FindAssemblyReference(assembly, "NBehave"); if (frameworkAssemblyName == null) { yield break; } yield return(new ToolInfo("NBehave", String.Format("NBehave v{0}", frameworkAssemblyName.Version))); }
public PreserveWorkingFolder(IAssemblyInfo assemblyInfo) { #if !WINDOWS_PHONE_APP originalWorkingFolder = Directory.GetCurrentDirectory(); if (!String.IsNullOrEmpty(assemblyInfo.AssemblyPath)) { Directory.SetCurrentDirectory(Path.GetDirectoryName(assemblyInfo.AssemblyPath)); } #endif }
public static bool IsFieldProperty(IMember propertyMember, IAssemblyInfo assemblyInfo) { bool isAuto = propertyMember.Attributes.Any(a => a.AttributeType.FullName == "Bridge.FieldPropertyAttribute"); if (!isAuto && assemblyInfo.AutoPropertyToField && propertyMember is IProperty) { return(propertyMember.DeclaringType.Kind == TypeKind.Interface || Helpers.IsAutoProperty((IProperty)propertyMember)); } return(isAuto || assemblyInfo.AutoPropertyToField); }
public PreserveWorkingFolder(IAssemblyInfo assemblyInfo) { #if NETFRAMEWORK originalWorkingFolder = Directory.GetCurrentDirectory(); if (!string.IsNullOrEmpty(assemblyInfo.AssemblyPath)) { Directory.SetCurrentDirectory(Path.GetDirectoryName(assemblyInfo.AssemblyPath)); } #endif }
/// <summary> /// Initializes a new instance of the <see cref="DocumentedAssembly"/> class. /// </summary> /// <param name="info">The assembly information.</param> /// <param name="namespaces">The namespaces.</param> /// <param name="metadata">The associated metadata.</param> public DocumentedAssembly( IAssemblyInfo info, IEnumerable <DocumentedNamespace> namespaces, IDocumentationMetadata metadata) : base(MemberClassification.Assembly, null, null, null, metadata) { _definition = info.Definition; _identity = info.Identity; _name = GetAssemblyName(info); _namespaces = new List <DocumentedNamespace>(namespaces); }
private static string GetAssemblyName(IAssemblyInfo info) { var name = info.Identity; var index = name.IndexOf(", ", 0, StringComparison.Ordinal); if (index != -1) { name = string.Concat(name.Substring(0, index), ".dll"); } return(name); }
public TestAssemblyRunner(IAssemblyInfo assemblyInfo, IEnumerable<ITestCase> testCases, IMessageSink messageSink, ITestFrameworkOptions executionOptions) { AssemblyInfo = assemblyInfo; AssemblyFileName = AssemblyInfo.AssemblyPath; TestCases = testCases; MessageSink = messageSink; ExecutionOptions = executionOptions; TestCaseOrderer = new DefaultTestCaseOrderer(); }
private static bool IsConcordionAttributePresent(IAssemblyInfo assembly) { foreach (var assemblyAttribute in assembly.GetAttributes(null, false)) { if (assemblyAttribute is ConcordionAssemblyAttribute) { return(true); } } return(false); }
protected void PopulateAssemblyTestMetadata(Test assemblyTest, IAssemblyInfo assembly) { ModelUtils.PopulateMetadataFromAssembly(assembly, assemblyTest.Metadata); Version frameworkVersion = GetFrameworkVersion(assembly); string frameworkName = String.Format(Resources.NUnitTestExplorer_FrameworkNameWithVersionFormat, frameworkVersion); assemblyTest.Metadata.SetValue(MetadataKeys.Framework, frameworkName); assemblyTest.Metadata.SetValue(MetadataKeys.File, assembly.Path); assemblyTest.Kind = NUnitTestExplorer.AssemblyKind; }