Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 29 additions & 27 deletions TestRunner/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,45 +44,47 @@ static void Main(string[] args)
{
LoadAllTestAssemblies();

if (args.Length == 0)

while (args.Length == 0 || !m_TestMethods.ContainsKey(args[0]))
{
Console.WriteLine("Please provide a filter for the methods you want to run. This can be either the name of the method or its namespace (after 'BH.Test')");
return;
if (args.Length == 0)
Console.WriteLine("Please provide a filter for the methods you want to run. This can be either the name of the method or its namespace (after 'BH.Test')");
else
Console.WriteLine("Cannot find any test matching " + args[0]);
Comment thread
IsakNaslundBh marked this conversation as resolved.
Outdated

Console.WriteLine($"Avilable methods to run are: {string.Join(", ", m_TestMethods.Keys)}");
Comment thread
IsakNaslundBh marked this conversation as resolved.
Outdated

args = Console.ReadLine().Split(' ');
Comment thread
IsakNaslundBh marked this conversation as resolved.
}

string key = args[0];
if (!m_TestMethods.ContainsKey(key))
{
Console.WriteLine("Cannot find any test matching " + key);
}
else

foreach (MethodInfo method in m_TestMethods[key])
{
foreach (MethodInfo method in m_TestMethods[key])
try
{
try
object[] parameters = new object[] { };
if (method.GetParameters().Length == 1)
{
object[] parameters = new object[] { };
if (method.GetParameters().Length == 1)
if (args.Length == 2)
{
if (args.Length == 2)
{
parameters = new object[] { System.Convert.ToBoolean(args[1]) };
}
else if (method.GetParameters()[0].HasDefaultValue)
{
parameters = new object[] { method.GetParameters()[0].DefaultValue };
}
parameters = new object[] { System.Convert.ToBoolean(args[1]) };
}
else if (method.GetParameters()[0].HasDefaultValue)
{
parameters = new object[] { method.GetParameters()[0].DefaultValue };
}
TestResult result = method.Invoke(null, parameters) as TestResult;
Console.WriteLine();
Console.Write(result.FullMessage());
}
catch (Exception e)
{
Console.WriteLine($"Method {method.Name} failed to run:\n{e.Message}");
}
TestResult result = method.Invoke(null, parameters) as TestResult;
Console.WriteLine();
Console.Write(result.FullMessage());
}
catch (Exception e)
{
Console.WriteLine($"Method {method.Name} failed to run:\n{e.Message}");
}
}

}


Expand Down