Last change
on this file since 5404 was
5306,
checked in by mkommend, 14 years ago
|
Corrected HL3.3 tests project to test all assemblies and not only assemblies that contain a Plugin class (ticket #1351).
|
File size:
1.0 KB
|
Rev | Line | |
---|
[4486] | 1 |
|
---|
[4490] | 2 | using System;
|
---|
| 3 | using System.Collections.Generic;
|
---|
| 4 | using System.IO;
|
---|
| 5 | using System.Linq;
|
---|
| 6 | using System.Reflection;
|
---|
| 7 | using HeuristicLab.PluginInfrastructure;
|
---|
| 8 |
|
---|
[4512] | 9 | namespace HeuristicLab_33.Tests {
|
---|
[4486] | 10 | internal static class PluginLoader {
|
---|
[4490] | 11 | public const string AssemblyExtension = ".dll";
|
---|
[5151] | 12 | public const string TestAccessorAssemblyExtension = "_Accessor.dll";
|
---|
[5272] | 13 | public const string TestAssemblyExtension = ".Tests.dll";
|
---|
[5306] | 14 | public static List<Assembly> Assemblies;
|
---|
[4487] | 15 |
|
---|
[4490] | 16 | static PluginLoader() {
|
---|
[4508] | 17 | foreach (string path in Directory.EnumerateFiles(Environment.CurrentDirectory)
|
---|
[5151] | 18 | .Where(s => s.EndsWith(AssemblyExtension) && !s.EndsWith(TestAccessorAssemblyExtension) && !s.EndsWith(TestAssemblyExtension)))
|
---|
[4490] | 19 | Assembly.LoadFrom(path);
|
---|
[4487] | 20 |
|
---|
[5306] | 21 | Assemblies = AppDomain.CurrentDomain.GetAssemblies().ToList();
|
---|
[4490] | 22 | }
|
---|
[4487] | 23 |
|
---|
[5306] | 24 | public static bool IsPluginAssembly(Assembly assembly) {
|
---|
[4490] | 25 | return assembly.GetExportedTypes()
|
---|
| 26 | .Where(t => typeof(IPlugin).IsAssignableFrom(t) && !t.IsAbstract && !t.IsInterface).Any();
|
---|
| 27 | }
|
---|
[4486] | 28 | }
|
---|
| 29 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.