3 people like it.

TAP runner

Test Anything Protocol runner for NUnit lets you run unit tests within an F# interactive session.

  1: 
  2: 
  3: 
  4: 
  5: 
  6: 
  7: 
  8: 
  9: 
 10: 
 11: 
 12: 
 13: 
 14: 
 15: 
 16: 
 17: 
 18: 
 19: 
 20: 
 21: 
 22: 
 23: 
 24: 
 25: 
 26: 
 27: 
 28: 
 29: 
 30: 
 31: 
 32: 
 33: 
 34: 
 35: 
 36: 
 37: 
 38: 
 39: 
 40: 
 41: 
 42: 
 43: 
 44: 
 45: 
 46: 
 47: 
 48: 
 49: 
 50: 
 51: 
 52: 
 53: 
 54: 
 55: 
 56: 
 57: 
 58: 
 59: 
 60: 
 61: 
 62: 
 63: 
 64: 
 65: 
 66: 
 67: 
 68: 
 69: 
 70: 
 71: 
 72: 
 73: 
 74: 
 75: 
 76: 
 77: 
 78: 
 79: 
 80: 
 81: 
 82: 
 83: 
 84: 
 85: 
 86: 
 87: 
 88: 
 89: 
 90: 
 91: 
 92: 
 93: 
 94: 
 95: 
 96: 
 97: 
 98: 
 99: 
100: 
101: 
102: 
103: 
104: 
105: 
106: 
107: 
108: 
109: 
110: 
111: 
112: 
113: 
114: 
115: 
116: 
117: 
118: 
119: 
120: 
121: 
122: 
123: 
124: 
125: 
126: 
127: 
128: 
129: 
130: 
131: 
132: 
133: 
134: 
135: 
136: 
137: 
138: 
139: 
140: 
141: 
module Tap

open System
open System.Reflection
open NUnit.Framework

module internal List =
    let rec combinations = function
    | [] -> [[]]
    | hs :: tss ->
        [ for h in hs do
            for ts in combinations tss ->
                h :: ts ]

module internal GenerateTests =

   type ExpectedException = ExceptionType of Type
   type Test = Test of MethodInfo * obj[] * obj option * Type option

   let getCustomAttribute<'TAttribute when 'TAttribute :> Attribute> (mi:MethodInfo) = 
      mi.GetCustomAttribute(typeof<'TAttribute>, true) :?> 'TAttribute

   let toExpectedException (mi:MethodInfo) =
      let attr = getCustomAttribute<ExpectedExceptionAttribute>(mi)
      if attr <> null then Some attr.ExpectedException else None
   
   let (|Ignore|_|) (mi:MethodInfo) =
      if getCustomAttribute<IgnoreAttribute>(mi) <> null then Some() else None

   let (|TestCases|_|) (mi:MethodInfo) =
      let cases = mi.GetCustomAttributes(typeof<TestCaseAttribute>, true)
      if cases.Length > 0 then Some(cases |> Seq.cast<TestCaseAttribute>)
      else None

   let (|TestCaseSource|_|) (mi:MethodInfo) =
      let source = getCustomAttribute<TestCaseSourceAttribute>(mi)
      if source <> null then Some(source.SourceName, source.SourceType)
      else None

   let (|UnitTest|_|) (mi:MethodInfo) =
      if getCustomAttribute<TestAttribute>(mi) <> null then Some() else None

   let fromCases (mi:MethodInfo) (cases:TestCaseAttribute seq) =
      let ex = toExpectedException(mi)
      [|for case in cases ->
         let expected = if case.HasExpectedResult then Some case.ExpectedResult else None
         Test(mi, case.Arguments, expected, ex)
      |]

   let fromValues (mi:MethodInfo) =
      [| let ps = mi.GetParameters()
         let argValues =
            [for p in ps ->
               match p.GetCustomAttribute(typeof<ValuesAttribute>, true) with
               | :? ValuesAttribute as attr -> [for x in attr.GetData(p) -> x]
               | _ -> invalidOp "Expecting values"]
         let ex = toExpectedException mi
         match List.combinations argValues with
         | [] -> yield Test(mi, [||], None, ex)
         | xs -> yield! [for args in xs -> Test(mi, List.toArray args, None, ex)]
      |]

   let fromSource instance (mi:MethodInfo) (sourceName,sourceType:Type) =
      let pi = mi.DeclaringType.GetProperty(sourceName)
      let getter = pi.GetGetMethod()
      let instance = if sourceType <> null then Activator.CreateInstance(sourceType) else instance
      let data = getter.Invoke(instance, [||]) :?> System.Collections.IEnumerable
      let ex = toExpectedException mi
      [|for item in data ->
         match item with
         | :? TestCaseData as case ->
            let expected = if case.HasExpectedResult then Some(case.Result) else None
            Test(mi, case.Arguments, expected, ex) 
         | :? (obj[]) as args -> Test(mi, args, None, ex)
         | arg -> Test(mi, [|arg|], None, ex)
      |]

   let generateTests instance (mi:MethodInfo) =
      match mi with
      | Ignore -> [||]
      | TestCases cases -> fromCases mi cases
      | TestCaseSource(data) -> fromSource instance mi data
      | UnitTest -> fromValues mi
      | _ -> [||]

   let runTest instance (Test(mi,args,expected,exType)) = 
      try
         let actual = mi.Invoke(instance,args)
         match expected with
         | Some expected -> Assert.AreEqual(expected, actual)
         | None -> ()
         None
      with ex -> 
         match exType with
         | Some t when t = ex.GetType() -> None
         | _ -> Some ex

   let color c =
      let previous = Console.ForegroundColor
      Console.ForegroundColor <- c
      { new System.IDisposable with 
         member __.Dispose() = Console.ForegroundColor <- previous
      }

   let showResult number (Test(mi,args,_,_)) error =
      let name =
         mi.Name + 
            if args.Length > 0 then "(" + String.Join(",", args) + ")"
            else ""
      match error with
      | None ->
         using (color ConsoleColor.Green) <| fun _ ->
            printfn "ok %d - %s" number name
      | Some e ->
         using (color ConsoleColor.Red) <| fun _ ->
            printfn "not ok %d - %s" number name
            printfn "  %A" e

   let runTests instance (tests:Test[]) =
      printfn "1..%d" tests.Length
      tests |> Array.iteri (fun i test ->
         runTest instance test |> showResult (i+1) test 
      )

open GenerateTests

let Run (testType:System.Type) =
   let instance = null
   let constr = testType.GetConstructor([||])
   let instance = if constr <> null then constr.Invoke([||]) else null
   let methods = testType.GetMethods()
   let tests = [|for mi in methods do yield! generateTests instance mi|]
  
   let runMethodsWithAttribute attr = 
      methods 
      |> Array.filter (fun mi -> mi.GetCustomAttribute(attr, true) <> null)
      |> Array.iter (fun mi -> mi.Invoke(instance,[||]) |> ignore)

   runMethodsWithAttribute typeof<SetUpAttribute>  
   runTests instance tests
   runMethodsWithAttribute typeof<TearDownAttribute>
module Tap
namespace System
namespace System.Reflection
namespace NUnit
namespace NUnit.Framework
Multiple items
type List =
  new : unit -> List
  static member Map : actual:ICollection -> ListMapper

Full name: NUnit.Framework.List

--------------------
type List<'T> =
  | ( [] )
  | ( :: ) of Head: 'T * Tail: 'T list
  interface IEnumerable
  interface IEnumerable<'T>
  member Head : 'T
  member IsEmpty : bool
  member Item : index:int -> 'T with get
  member Length : int
  member Tail : 'T list
  static member Cons : head:'T * tail:'T list -> 'T list
  static member Empty : 'T list

Full name: Microsoft.FSharp.Collections.List<_>

--------------------
List() : unit
val internal combinations : _arg1:#seq<'b> list -> 'b list list

Full name: Tap.List.combinations
val hs : #seq<'b>
val tss : #seq<'b> list
val h : 'b
val ts : 'b list
Multiple items
type internal ExpectedException = | ExceptionType of Type

Full name: Tap.GenerateTests.ExpectedException

--------------------
type ExpectedExceptionAttribute =
  inherit Attribute
  new : unit -> ExpectedExceptionAttribute + 2 overloads
  member ExpectedException : Type with get, set
  member ExpectedExceptionName : string with get, set
  member ExpectedMessage : string with get, set
  member Handler : string with get, set
  member MatchType : MessageMatch with get, set
  member UserMessage : string with get, set

Full name: NUnit.Framework.ExpectedExceptionAttribute

--------------------
ExpectedExceptionAttribute() : unit
ExpectedExceptionAttribute(exceptionType: Type) : unit
ExpectedExceptionAttribute(exceptionName: string) : unit
union case ExpectedException.ExceptionType: Type -> ExpectedException
type Type =
  inherit MemberInfo
  member Assembly : Assembly
  member AssemblyQualifiedName : string
  member Attributes : TypeAttributes
  member BaseType : Type
  member ContainsGenericParameters : bool
  member DeclaringMethod : MethodBase
  member DeclaringType : Type
  member Equals : o:obj -> bool + 1 overload
  member FindInterfaces : filter:TypeFilter * filterCriteria:obj -> Type[]
  member FindMembers : memberType:MemberTypes * bindingAttr:BindingFlags * filter:MemberFilter * filterCriteria:obj -> MemberInfo[]
  ...

Full name: System.Type
Multiple items
union case Test.Test: MethodInfo * obj [] * obj option * Type option -> Test

--------------------
type internal Test = | Test of MethodInfo * obj [] * obj option * Type option

Full name: Tap.GenerateTests.Test

--------------------
type TestAttribute =
  inherit Attribute
  new : unit -> TestAttribute
  member Description : string with get, set

Full name: NUnit.Framework.TestAttribute

--------------------
TestAttribute() : unit
type MethodInfo =
  inherit MethodBase
  member Equals : obj:obj -> bool
  member GetBaseDefinition : unit -> MethodInfo
  member GetGenericArguments : unit -> Type[]
  member GetGenericMethodDefinition : unit -> MethodInfo
  member GetHashCode : unit -> int
  member MakeGenericMethod : [<ParamArray>] typeArguments:Type[] -> MethodInfo
  member MemberType : MemberTypes
  member ReturnParameter : ParameterInfo
  member ReturnType : Type
  member ReturnTypeCustomAttributes : ICustomAttributeProvider

Full name: System.Reflection.MethodInfo
type obj = Object

Full name: Microsoft.FSharp.Core.obj
type 'T option = Option<'T>

Full name: Microsoft.FSharp.Core.option<_>
val internal getCustomAttribute : mi:MethodInfo -> #Attribute

Full name: Tap.GenerateTests.getCustomAttribute
type Attribute =
  member Equals : obj:obj -> bool
  member GetHashCode : unit -> int
  member IsDefaultAttribute : unit -> bool
  member Match : obj:obj -> bool
  member TypeId : obj
  static member GetCustomAttribute : element:MemberInfo * attributeType:Type -> Attribute + 7 overloads
  static member GetCustomAttributes : element:MemberInfo -> Attribute[] + 15 overloads
  static member IsDefined : element:MemberInfo * attributeType:Type -> bool + 7 overloads

Full name: System.Attribute
val mi : MethodInfo
val typeof<'T> : Type

Full name: Microsoft.FSharp.Core.Operators.typeof
val internal toExpectedException : mi:MethodInfo -> Type option

Full name: Tap.GenerateTests.toExpectedException
val attr : ExpectedExceptionAttribute
Multiple items
type ExpectedExceptionAttribute =
  inherit Attribute
  new : unit -> ExpectedExceptionAttribute + 2 overloads
  member ExpectedException : Type with get, set
  member ExpectedExceptionName : string with get, set
  member ExpectedMessage : string with get, set
  member Handler : string with get, set
  member MatchType : MessageMatch with get, set
  member UserMessage : string with get, set

Full name: NUnit.Framework.ExpectedExceptionAttribute

--------------------
ExpectedExceptionAttribute() : unit
ExpectedExceptionAttribute(exceptionType: Type) : unit
ExpectedExceptionAttribute(exceptionName: string) : unit
union case Option.Some: Value: 'T -> Option<'T>
property ExpectedExceptionAttribute.ExpectedException: Type
union case Option.None: Option<'T>
Multiple items
type IgnoreAttribute =
  inherit Attribute
  new : unit -> IgnoreAttribute + 1 overload
  member Reason : string

Full name: NUnit.Framework.IgnoreAttribute

--------------------
IgnoreAttribute() : unit
IgnoreAttribute(reason: string) : unit
val cases : obj []
MemberInfo.GetCustomAttributes(inherit: bool) : obj []
MemberInfo.GetCustomAttributes(attributeType: Type, inherit: bool) : obj []
Multiple items
type TestCaseAttribute =
  inherit Attribute
  new : [<ParamArray>] arguments:obj[] -> TestCaseAttribute + 3 overloads
  member Arguments : obj[]
  member Categories : IList
  member Category : string with get, set
  member Description : string with get, set
  member ExpectedException : Type with get, set
  member ExpectedExceptionName : string with get, set
  member ExpectedMessage : string with get, set
  member ExpectedResult : obj with get, set
  member Explicit : bool with get, set
  ...

Full name: NUnit.Framework.TestCaseAttribute

--------------------
TestCaseAttribute([<ParamArray>] arguments: obj []) : unit
TestCaseAttribute(arg: obj) : unit
TestCaseAttribute(arg1: obj, arg2: obj) : unit
TestCaseAttribute(arg1: obj, arg2: obj, arg3: obj) : unit
property Array.Length: int
module Seq

from Microsoft.FSharp.Collections
val cast : source:Collections.IEnumerable -> seq<'T>

Full name: Microsoft.FSharp.Collections.Seq.cast
Multiple items
type TestCaseSourceAttribute =
  inherit Attribute
  new : sourceName:string -> TestCaseSourceAttribute + 2 overloads
  member Category : string with get, set
  member SourceName : string
  member SourceType : Type

Full name: NUnit.Framework.TestCaseSourceAttribute

--------------------
TestCaseSourceAttribute(sourceName: string) : unit
TestCaseSourceAttribute(sourceType: Type) : unit
TestCaseSourceAttribute(sourceType: Type, sourceName: string) : unit
val source : TestCaseSourceAttribute
property TestCaseSourceAttribute.SourceName: string
property TestCaseSourceAttribute.SourceType: Type
Multiple items
type TestAttribute =
  inherit Attribute
  new : unit -> TestAttribute
  member Description : string with get, set

Full name: NUnit.Framework.TestAttribute

--------------------
TestAttribute() : unit
val internal fromCases : mi:MethodInfo -> cases:seq<TestCaseAttribute> -> Test []

Full name: Tap.GenerateTests.fromCases
val cases : seq<TestCaseAttribute>
Multiple items
val seq : sequence:seq<'T> -> seq<'T>

Full name: Microsoft.FSharp.Core.Operators.seq

--------------------
type seq<'T> = Collections.Generic.IEnumerable<'T>

Full name: Microsoft.FSharp.Collections.seq<_>
val ex : Type option
val case : TestCaseAttribute
val expected : obj option
property TestCaseAttribute.HasExpectedResult: bool
property TestCaseAttribute.ExpectedResult: obj
property TestCaseAttribute.Arguments: obj []
val internal fromValues : mi:MethodInfo -> Test []

Full name: Tap.GenerateTests.fromValues
val ps : ParameterInfo []
MethodBase.GetParameters() : ParameterInfo []
val argValues : seq<obj> list
val p : ParameterInfo
Multiple items
type ValuesAttribute =
  inherit ParameterDataAttribute
  new : arg1:obj -> ValuesAttribute + 3 overloads
  member GetData : parameter:ParameterInfo -> IEnumerable

Full name: NUnit.Framework.ValuesAttribute

--------------------
ValuesAttribute(arg1: obj) : unit
ValuesAttribute([<ParamArray>] args: obj []) : unit
ValuesAttribute(arg1: obj, arg2: obj) : unit
ValuesAttribute(arg1: obj, arg2: obj, arg3: obj) : unit
val invalidOp : message:string -> 'T

Full name: Microsoft.FSharp.Core.Operators.invalidOp
val xs : obj list list
val args : obj list
val toArray : list:'T list -> 'T []

Full name: Microsoft.FSharp.Collections.List.toArray
val internal fromSource : instance:obj -> mi:MethodInfo -> sourceName:string * sourceType:Type -> Test []

Full name: Tap.GenerateTests.fromSource
val instance : obj
val sourceName : string
val sourceType : Type
val pi : PropertyInfo
property MemberInfo.DeclaringType: Type
Type.GetProperty(name: string) : PropertyInfo
Type.GetProperty(name: string, returnType: Type) : PropertyInfo
Type.GetProperty(name: string, types: Type []) : PropertyInfo
Type.GetProperty(name: string, bindingAttr: BindingFlags) : PropertyInfo
Type.GetProperty(name: string, returnType: Type, types: Type []) : PropertyInfo
Type.GetProperty(name: string, returnType: Type, types: Type [], modifiers: ParameterModifier []) : PropertyInfo
Type.GetProperty(name: string, bindingAttr: BindingFlags, binder: Binder, returnType: Type, types: Type [], modifiers: ParameterModifier []) : PropertyInfo
val getter : MethodInfo
PropertyInfo.GetGetMethod() : MethodInfo
PropertyInfo.GetGetMethod(nonPublic: bool) : MethodInfo
type Activator =
  static member CreateComInstanceFrom : assemblyName:string * typeName:string -> ObjectHandle + 1 overload
  static member CreateInstance<'T> : unit -> 'T + 15 overloads
  static member CreateInstanceFrom : assemblyFile:string * typeName:string -> ObjectHandle + 6 overloads
  static member GetObject : type:Type * url:string -> obj + 1 overload

Full name: System.Activator
Activator.CreateInstance<'T>() : 'T
   (+0 other overloads)
Activator.CreateInstance(activationContext: ActivationContext) : Runtime.Remoting.ObjectHandle
   (+0 other overloads)
Activator.CreateInstance(type: Type) : obj
   (+0 other overloads)
Activator.CreateInstance(activationContext: ActivationContext, activationCustomData: string []) : Runtime.Remoting.ObjectHandle
   (+0 other overloads)
Activator.CreateInstance(type: Type, nonPublic: bool) : obj
   (+0 other overloads)
Activator.CreateInstance(assemblyName: string, typeName: string) : Runtime.Remoting.ObjectHandle
   (+0 other overloads)
Activator.CreateInstance(type: Type, [<ParamArray>] args: obj []) : obj
   (+0 other overloads)
Activator.CreateInstance(domain: AppDomain, assemblyName: string, typeName: string) : Runtime.Remoting.ObjectHandle
   (+0 other overloads)
Activator.CreateInstance(assemblyName: string, typeName: string, activationAttributes: obj []) : Runtime.Remoting.ObjectHandle
   (+0 other overloads)
Activator.CreateInstance(type: Type, args: obj [], activationAttributes: obj []) : obj
   (+0 other overloads)
val data : Collections.IEnumerable
MethodBase.Invoke(obj: obj, parameters: obj []) : obj
MethodBase.Invoke(obj: obj, invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj
namespace System.Collections
type IEnumerable =
  member GetEnumerator : unit -> IEnumerator

Full name: System.Collections.IEnumerable
val item : obj
Multiple items
type TestCaseData =
  new : [<ParamArray>] args:obj[] -> TestCaseData + 3 overloads
  member Arguments : obj[]
  member Categories : IList
  member Description : string
  member ExpectedException : Type
  member ExpectedExceptionName : string
  member Explicit : bool
  member HasExpectedResult : bool
  member Ignore : unit -> TestCaseData + 1 overload
  member IgnoreReason : string
  ...

Full name: NUnit.Framework.TestCaseData

--------------------
TestCaseData([<ParamArray>] args: obj []) : unit
TestCaseData(arg: obj) : unit
TestCaseData(arg1: obj, arg2: obj) : unit
TestCaseData(arg1: obj, arg2: obj, arg3: obj) : unit
val case : TestCaseData
property TestCaseData.HasExpectedResult: bool
property TestCaseData.Result: obj
property TestCaseData.Arguments: obj []
val args : obj []
val arg : obj
val internal generateTests : instance:'a -> mi:MethodInfo -> Test []

Full name: Tap.GenerateTests.generateTests
val instance : 'a
Multiple items
active recognizer Ignore: MethodInfo -> unit option

Full name: Tap.GenerateTests.( |Ignore|_| )

--------------------
type IgnoreAttribute =
  inherit Attribute
  new : unit -> IgnoreAttribute + 1 overload
  member Reason : string

Full name: NUnit.Framework.IgnoreAttribute

--------------------
IgnoreAttribute() : unit
IgnoreAttribute(reason: string) : unit
active recognizer TestCases: MethodInfo -> seq<TestCaseAttribute> option

Full name: Tap.GenerateTests.( |TestCases|_| )
Multiple items
active recognizer TestCaseSource: MethodInfo -> (string * Type) option

Full name: Tap.GenerateTests.( |TestCaseSource|_| )

--------------------
type TestCaseSourceAttribute =
  inherit Attribute
  new : sourceName:string -> TestCaseSourceAttribute + 2 overloads
  member Category : string with get, set
  member SourceName : string
  member SourceType : Type

Full name: NUnit.Framework.TestCaseSourceAttribute

--------------------
TestCaseSourceAttribute(sourceName: string) : unit
TestCaseSourceAttribute(sourceType: Type) : unit
TestCaseSourceAttribute(sourceType: Type, sourceName: string) : unit
val data : string * Type
active recognizer UnitTest: MethodInfo -> unit option

Full name: Tap.GenerateTests.( |UnitTest|_| )
val internal runTest : instance:'a -> Test -> exn option

Full name: Tap.GenerateTests.runTest
val exType : Type option
val actual : obj
val expected : obj
type Assert =
  static member AreEqual : expected:int * actual:int -> unit + 23 overloads
  static member AreNotEqual : expected:int * actual:int -> unit + 23 overloads
  static member AreNotSame : expected:obj * actual:obj -> unit + 2 overloads
  static member AreSame : expected:obj * actual:obj -> unit + 2 overloads
  static member ByVal : actual:obj * expression:IResolveConstraint -> unit + 2 overloads
  static member Catch : code:TestDelegate -> Exception + 8 overloads
  static member Contains : expected:obj * actual:ICollection -> unit + 2 overloads
  static member Counter : int
  static member DoesNotThrow : code:TestDelegate -> unit + 2 overloads
  static member Equals : a:obj * b:obj -> bool
  ...

Full name: NUnit.Framework.Assert
Assert.AreEqual(expected: obj, actual: obj) : unit
   (+0 other overloads)
Assert.AreEqual(expected: decimal, actual: decimal) : unit
   (+0 other overloads)
Assert.AreEqual(expected: uint64, actual: uint64) : unit
   (+0 other overloads)
Assert.AreEqual(expected: uint32, actual: uint32) : unit
   (+0 other overloads)
Assert.AreEqual(expected: int64, actual: int64) : unit
   (+0 other overloads)
Assert.AreEqual(expected: int, actual: int) : unit
   (+0 other overloads)
Assert.AreEqual(expected: obj, actual: obj, message: string) : unit
   (+0 other overloads)
Assert.AreEqual(expected: float, actual: Nullable<float>, delta: float) : unit
   (+0 other overloads)
Assert.AreEqual(expected: float, actual: float, delta: float) : unit
   (+0 other overloads)
Assert.AreEqual(expected: decimal, actual: decimal, message: string) : unit
   (+0 other overloads)
val ex : exn
val t : Type
Exception.GetType() : Type
val internal color : c:ConsoleColor -> IDisposable

Full name: Tap.GenerateTests.color
val c : ConsoleColor
val previous : ConsoleColor
type Console =
  static member BackgroundColor : ConsoleColor with get, set
  static member Beep : unit -> unit + 1 overload
  static member BufferHeight : int with get, set
  static member BufferWidth : int with get, set
  static member CapsLock : bool
  static member Clear : unit -> unit
  static member CursorLeft : int with get, set
  static member CursorSize : int with get, set
  static member CursorTop : int with get, set
  static member CursorVisible : bool with get, set
  ...

Full name: System.Console
property Console.ForegroundColor: ConsoleColor
type IDisposable =
  member Dispose : unit -> unit

Full name: System.IDisposable
val internal showResult : number:int -> Test -> error:'a option -> unit

Full name: Tap.GenerateTests.showResult
val number : int
val error : 'a option
val name : string
property MemberInfo.Name: string
Multiple items
type String =
  new : value:char -> string + 7 overloads
  member Chars : int -> char
  member Clone : unit -> obj
  member CompareTo : value:obj -> int + 1 overload
  member Contains : value:string -> bool
  member CopyTo : sourceIndex:int * destination:char[] * destinationIndex:int * count:int -> unit
  member EndsWith : value:string -> bool + 2 overloads
  member Equals : obj:obj -> bool + 2 overloads
  member GetEnumerator : unit -> CharEnumerator
  member GetHashCode : unit -> int
  ...

Full name: System.String

--------------------
String(value: nativeptr<char>) : unit
String(value: nativeptr<sbyte>) : unit
String(value: char []) : unit
String(c: char, count: int) : unit
String(value: nativeptr<char>, startIndex: int, length: int) : unit
String(value: nativeptr<sbyte>, startIndex: int, length: int) : unit
String(value: char [], startIndex: int, length: int) : unit
String(value: nativeptr<sbyte>, startIndex: int, length: int, enc: Text.Encoding) : unit
String.Join(separator: string, values: Collections.Generic.IEnumerable<string>) : string
String.Join<'T>(separator: string, values: Collections.Generic.IEnumerable<'T>) : string
String.Join(separator: string, [<ParamArray>] values: obj []) : string
String.Join(separator: string, [<ParamArray>] value: string []) : string
String.Join(separator: string, value: string [], startIndex: int, count: int) : string
val using : resource:'T -> action:('T -> 'U) -> 'U (requires 'T :> IDisposable)

Full name: Microsoft.FSharp.Core.Operators.using
type ConsoleColor =
  | Black = 0
  | DarkBlue = 1
  | DarkGreen = 2
  | DarkCyan = 3
  | DarkRed = 4
  | DarkMagenta = 5
  | DarkYellow = 6
  | Gray = 7
  | DarkGray = 8
  | Blue = 9
  ...

Full name: System.ConsoleColor
field ConsoleColor.Green = 10
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
val e : 'a
field ConsoleColor.Red = 12
val internal runTests : instance:'a -> tests:Test [] -> unit

Full name: Tap.GenerateTests.runTests
val tests : Test []
type Array =
  member Clone : unit -> obj
  member CopyTo : array:Array * index:int -> unit + 1 overload
  member GetEnumerator : unit -> IEnumerator
  member GetLength : dimension:int -> int
  member GetLongLength : dimension:int -> int64
  member GetLowerBound : dimension:int -> int
  member GetUpperBound : dimension:int -> int
  member GetValue : [<ParamArray>] indices:int[] -> obj + 7 overloads
  member Initialize : unit -> unit
  member IsFixedSize : bool
  ...

Full name: System.Array
val iteri : action:(int -> 'T -> unit) -> array:'T [] -> unit

Full name: Microsoft.FSharp.Collections.Array.iteri
val i : int
val test : Test
module GenerateTests

from Tap
val Run : testType:Type -> unit

Full name: Tap.Run
val testType : Type
val instance : 'a (requires 'a : null)
val constr : ConstructorInfo
Type.GetConstructor(types: Type []) : ConstructorInfo
Type.GetConstructor(bindingAttr: BindingFlags, binder: Binder, types: Type [], modifiers: ParameterModifier []) : ConstructorInfo
Type.GetConstructor(bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type [], modifiers: ParameterModifier []) : ConstructorInfo
ConstructorInfo.Invoke(parameters: obj []) : obj
MethodBase.Invoke(obj: obj, parameters: obj []) : obj
ConstructorInfo.Invoke(invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj
MethodBase.Invoke(obj: obj, invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj
val methods : MethodInfo []
Type.GetMethods() : MethodInfo []
Type.GetMethods(bindingAttr: BindingFlags) : MethodInfo []
val runMethodsWithAttribute : ('a -> unit)
val attr : 'a
val filter : predicate:('T -> bool) -> array:'T [] -> 'T []

Full name: Microsoft.FSharp.Collections.Array.filter
val iter : action:('T -> unit) -> array:'T [] -> unit

Full name: Microsoft.FSharp.Collections.Array.iter
val ignore : value:'T -> unit

Full name: Microsoft.FSharp.Core.Operators.ignore
Multiple items
type SetUpAttribute =
  inherit Attribute
  new : unit -> SetUpAttribute

Full name: NUnit.Framework.SetUpAttribute

--------------------
SetUpAttribute() : unit
Multiple items
type TearDownAttribute =
  inherit Attribute
  new : unit -> TearDownAttribute

Full name: NUnit.Framework.TearDownAttribute

--------------------
TearDownAttribute() : unit
Next Version Raw view Test code New version

More information

Link:http://fssnip.net/nD
Posted:10 years ago
Author:Phillip Trelford
Tags: unit testing