Skip to content

Instantly share code, notes, and snippets.

@andyhasit
Created October 26, 2014 17:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andyhasit/a07cf3f473209343bdfd to your computer and use it in GitHub Desktop.
Save andyhasit/a07cf3f473209343bdfd to your computer and use it in GitHub Desktop.
MircoTest
namespace DataTransferScript # ThirtyLineTestFramework
import System
import System.Reflection
import System.Runtime.Serialization
def RunTests():
passCount = 0
failCount = 0
previousConsoleColour = Console.ForegroundColor
print "Running Tests"
myAssembly = Assembly.GetExecutingAssembly()
for type in myAssembly.GetTypes():
for methodInfo in type.GetMethods():
if methodInfo.Name.StartsWith("Test"):
try:
myObject = FormatterServices.GetUninitializedObject(type)
methodInfo.Invoke(myObject, null)
Console.ForegroundColor = ConsoleColor.Green
print "${methodInfo.Name}"
passCount += 1
except e as Exception:
Console.ForegroundColor = ConsoleColor.Red
print "${methodInfo.Name}"
print e
failCount += 1
Console.ForegroundColor = previousConsoleColour
print "Found ${passCount + failCount} tests. Pass: ${passCount}. Fail: ${failCount}."
Console.ReadLine()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment