// Console Spec Runner Helpers static void RunSpecification(factory_specs specification) { Console.WriteLine(new string('=', 80)); var cases = specification.GetType() .GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly); Print(ConsoleColor.DarkGreen, "Specification: {0}", specification.GetType().Name.Replace('_', ' ')); foreach (var methodInfo in cases) { Console.WriteLine(new string('-', 80)); Print(ConsoleColor.DarkBlue, "Use case: {0}", methodInfo.Name.Replace("_", " ")); Console.WriteLine(); try { specification.Setup(); methodInfo.Invoke(specification, null); Print(ConsoleColor.DarkGreen, "\r\nPASSED!"); } catch (Exception ex) { Print(ConsoleColor.DarkRed, "\r\nFAIL! " + ex.Message); } } }
// Console Spec Runner Helpers static void RunSpecification(factory_specs specification) { Console.WriteLine(new string('=', 80)); var cases = specification.GetType() .GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly); Print(ConsoleColor.DarkGreen, "Specification: {0}", specification.GetType().Name.Replace('_',' ')); foreach (var methodInfo in cases) { Console.WriteLine(new string('-', 80)); Print(ConsoleColor.DarkBlue, "Use case: {0}", methodInfo.Name.Replace("_", " ")); Console.WriteLine(); try { specification.Setup(); methodInfo.Invoke(specification, null); Print(ConsoleColor.DarkGreen, "\r\nPASSED!"); } catch(Exception ex) { Print(ConsoleColor.DarkRed, "\r\nFAIL! " + ex.Message); } } }