private static void OnTestFailed(ConsoleInvokeableMethod consoleMethod, Exception ex) { if (TestFailed != null) { TestFailed(null, new TestExceptionEventArgs(consoleMethod, ex)); } }
protected static void ShowMenu(List <ConsoleInvokeableMethod> actions) { for (int i = 1; i <= actions.Count; i++) { ConsoleInvokeableMethod consoleMethod = actions[i - 1]; string menuOption = consoleMethod.Information; Console.WriteLine("{0}. {1}", i, menuOption); } }
private static void InvokeTest(ConsoleInvokeableMethod consoleMethod, bool generateParameters) { object[] parameters = GetParameterInput(consoleMethod.Method, generateParameters); if (consoleMethod.Method.IsStatic) { InvokeInSeparateAppDomain(consoleMethod.Method, null); //consoleMethod.Method.Invoke(null, parameters); } else { string typeName = consoleMethod.Method.DeclaringType.Name; ConstructorInfo ctor = consoleMethod.Method.DeclaringType.GetConstructor(Type.EmptyTypes); if (ctor == null) { ExceptionHelper.ThrowInvalidOperation("The declaring type {0} of method {1} does not have a parameterless constructor, test cannot be run.", typeName, consoleMethod.Method.Name); } object instance = ctor.Invoke(null); Expect.IsNotNull(instance, string.Format("Unable to instantiate declaring type {0} of method {1}", typeName, consoleMethod.Method.Name)); InvokeInSeparateAppDomain(consoleMethod.Method, instance); //consoleMethod.Method.Invoke(instance, null); } }
private static void InvokeTest(ConsoleInvokeableMethod consoleMethod, bool generateParameters) { object[] parameters = GetParameterInput(consoleMethod.Method, generateParameters); if (consoleMethod.Method.IsStatic) { InvokeInSeparateAppDomain(consoleMethod.Method, null); //consoleMethod.Method.Invoke(null, parameters); } else { string typeName = consoleMethod.Method.DeclaringType.Name; ConstructorInfo ctor = consoleMethod.Method.DeclaringType.GetConstructor(Type.EmptyTypes); if (ctor == null) ExceptionHelper.ThrowInvalidOperation("The declaring type {0} of method {1} does not have a parameterless constructor, test cannot be run.", typeName, consoleMethod.Method.Name); object instance = ctor.Invoke(null); Expect.IsNotNull(instance, string.Format("Unable to instantiate declaring type {0} of method {1}", typeName, consoleMethod.Method.Name)); InvokeInSeparateAppDomain(consoleMethod.Method, instance); //consoleMethod.Method.Invoke(instance, null); } }
private static void InvokeTest(ConsoleInvokeableMethod consoleMethod) { InvokeTest(consoleMethod, false); }
public TestExceptionEventArgs(ConsoleInvokeableMethod consoleInvokeableMethod, Exception ex) { this.ConsoleInvokeableMethod = consoleInvokeableMethod; this.Exception = ex; }