From 1b8f9e91dfc4a094bfcde43d61c39529eb874b7a Mon Sep 17 00:00:00 2001 From: Lars-Erik Aabech Date: Wed, 24 Apr 2019 22:12:17 +0200 Subject: [PATCH] TestOptionAttibute seam to discover testassemblies --- .../Testing/TestOptionAttributeBase.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Tests/Testing/TestOptionAttributeBase.cs b/src/Umbraco.Tests/Testing/TestOptionAttributeBase.cs index 9f72a022f3..a46d29180f 100644 --- a/src/Umbraco.Tests/Testing/TestOptionAttributeBase.cs +++ b/src/Umbraco.Tests/Testing/TestOptionAttributeBase.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using System.Reflection; using NUnit.Framework; @@ -8,6 +9,8 @@ namespace Umbraco.Tests.Testing { public abstract class TestOptionAttributeBase : Attribute { + public static readonly List ScanAssemblies = new List(); + public static TOptions GetTestOptions(MethodInfo method) where TOptions : TestOptionAttributeBase, new() { @@ -30,7 +33,15 @@ namespace Umbraco.Tests.Testing var methodName = test.MethodName; var type = Type.GetType(typeName, true); if (type == null) - throw new PanicException($"Could not resolve the type from type name {typeName}"); // makes no sense + { + type = ScanAssemblies + .Select(x => Type.GetType(typeName + ", " + x, false)) + .FirstOrDefault(x => x != null); + if (type == null) + { + throw new PanicException($"Could not resolve the type from type name {typeName}"); // makes no sense + } + } var methodInfo = type.GetMethod(methodName); // what about overloads? var options = GetTestOptions(methodInfo); return options;