2 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: 
142: 
143: 
144: 
145: 
146: 
147: 
148: 
149: 
150: 
151: 
152: 
153: 
154: 
155: 
156: 
157: 
158: 
159: 
160: 
161: 
162: 
163: 
164: 
165: 
166: 
167: 
168: 
169: 
170: 
171: 
172: 
173: 
174: 
175: 
176: 
177: 
178: 
179: 
180: 
181: 
182: 
183: 
184: 
185: 
186: 
187: 
188: 
189: 
190: 
191: 
192: 
193: 
194: 
195: 
196: 
197: 
198: 
199: 
200: 
201: 
202: 
203: 
204: 
205: 
206: 
207: 
208: 
209: 
210: 
211: 
212: 
213: 
214: 
215: 
216: 
217: 
218: 
219: 
/// Test Anything Protocol (TAP) NUnit runner
module Tap

open System
open System.Collections
open System.Reflection
open NUnit.Framework

type Args = obj[]
type ExpectedResult = obj option
type ExpectedException = Type option
type Timeout = int option
type Test = Test of MethodInfo * Args * ExpectedResult * ExpectedException * Timeout

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

module internal SourceData =

   let (|SourceProperty|_|) (name,t:Type) =
      let pi = t.GetProperty(name)
      if pi <> null then Some(pi.GetGetMethod()) else None

   let (|SourceMethod|_|) (name,t:Type) =
      let mi = t.GetMethod(name)
      if mi <> null then Some(mi) else None

   let getSourceData (instance:obj, instanceType) (sourceName,sourceType:Type) =
      match (sourceName,sourceType) with
      | SourceProperty mi | SourceMethod mi->
         let instance = 
            if instanceType <> sourceType 
            then Activator.CreateInstance(sourceType) 
            else instance
         let result = mi.Invoke(instance, [||]) 
         result :?> IEnumerable
      | _ -> invalidOp "Expecting property or method"

module internal ParameterData =

   open SourceData

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

   let tryGetCustomAttribute<'TAttribute when 'TAttribute :> Attribute> (pi:ParameterInfo) =
      match pi.GetCustomAttribute(typeof<'TAttribute>, true) with
      | :? 'TAttribute as attr -> Some attr
      | _ -> None

   let (|Random|_|) = tryGetCustomAttribute<RandomAttribute>
   let (|Range|_|) = tryGetCustomAttribute<RangeAttribute>
   let (|Values|_|) = tryGetCustomAttribute<ValuesAttribute>
   let (|ValueSource|_|) = tryGetCustomAttribute<ValueSourceAttribute>

   let getParameterData instance (pi:ParameterInfo) =
      match pi with
      | Random rand -> [for x in rand.GetData(pi) -> x]
      | Range range -> [for x in range.GetData(pi) -> x]
      | Values values -> [for x in values.GetData(pi) -> x]
      | ValueSource source ->
         let data = getSourceData instance (source.SourceName, source.SourceType)
         [for x in data -> x]
      | _ -> invalidOp "Expecting values"

module internal TestGeneration =

   open SourceData
   open ParameterData

   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
         let sourceType = 
            if source.SourceType <> null then source.SourceType else mi.DeclaringType
         Some(source.SourceName, sourceType)
      else None

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

   let tryGetExpectedException (mi:MethodInfo) =
      let attr = getCustomAttribute<ExpectedExceptionAttribute>(mi)
      if attr <> null then Some attr.ExpectedException else None

   let (|Timeout|_|) (mi:MethodInfo) =
      let attr = getCustomAttribute<TimeoutAttribute>(mi)
      if attr <> null then Some (attr.Properties.["Timeout"] :?> int) else None

   let (|MaxTime|_|) (mi:MethodInfo) =
      let attr = getCustomAttribute<MaxTimeAttribute>(mi)
      if attr <> null then Some (attr.Properties.["MaxTime"] :?> int) else None

   let tryGetTimeout = function Timeout ms | MaxTime ms -> Some ms | _ -> None
  
   let fromCases (mi:MethodInfo) (cases:TestCaseAttribute seq) =
      let ex = tryGetExpectedException(mi)
      let timeout = tryGetTimeout mi
      [|for case in cases ->
         let expected = if case.HasExpectedResult then Some case.ExpectedResult else None
         let ex = if case.ExpectedException <> null then Some(case.ExpectedException) else ex
         Test(mi, case.Arguments, expected, ex, timeout)
      |]

   let fromData instance (mi:MethodInfo) (data:IEnumerable) =
      let ex = tryGetExpectedException mi
      let timeout = tryGetTimeout mi
      [|for item in data ->
         match item with
         | :? TestCaseData as case ->
            let expected = if case.HasExpectedResult then Some(case.Result) else None
            let ex = if case.ExpectedException <> null then Some(case.ExpectedException) else ex
            Test(mi, case.Arguments, expected, ex, timeout) 
         | :? (obj[]) as args -> Test(mi, args, None, ex, timeout)
         | arg -> Test(mi, [|arg|], None, ex, timeout)
      |]

   let fromValues instance (mi:MethodInfo) =
      let ex = tryGetExpectedException mi
      let timeout = tryGetTimeout mi
      [| let ps = mi.GetParameters()
         let argValues = [for pi in ps -> getParameterData instance pi]
         match List.combinations argValues with
         | [] -> yield Test(mi, [||], None, ex, timeout)
         | xs -> yield! [for args in xs -> Test(mi, List.toArray args, None, ex, timeout)]
      |]

   let generateTests instance (mi:MethodInfo) =
      let instance = instance, mi.DeclaringType
      match mi with
      | Ignore -> [||]
      | TestCases cases -> fromCases mi cases
      | TestCaseSource source -> getSourceData instance source |> fromData instance mi
      | VanillaTest -> fromValues instance mi
      | _ -> [||]

module internal TestRunner =

   let runTest instance (Test(mi,args,expected,exType,timeout)) = 
      try
         let actual = 
            match timeout with
            | Some ms -> Async.RunSynchronously(async { return mi.Invoke(instance,args) }, ms)
            | None -> mi.Invoke(instance,args)
         match expected with
         | Some expected -> Assert.AreEqual(expected, actual)
         | None -> ()
         None
      with ex ->        
        match ex.InnerException with
        | :? SuccessException -> None
        | 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 (setUp,tearDown) (tests:Test[]) =
      printfn "1..%d" tests.Length
      tests |> Array.iteri (fun i test ->
         let result =
            try setUp (); runTest instance test
            finally tearDown ()
         result |> showResult (i+1) test 
      )

let Run (testType:Type) =
   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! TestGeneration.generateTests instance mi|]
  
   let methodsWithAttribute attr =
      methods |> Array.filter (fun mi -> mi.GetCustomAttribute(attr, true) <> null)

   let runMethods (methods:MethodInfo[]) = 
      methods |> Array.iter (fun mi -> mi.Invoke(instance,[||]) |> ignore)

   let setUps = methodsWithAttribute typeof<SetUpAttribute>
   let tearDowns = methodsWithAttribute typeof<SetUpAttribute>
   let setUp () = setUps |> runMethods
   let tearDown () = tearDowns |> runMethods

   methodsWithAttribute typeof<TestFixtureSetUpAttribute> |> runMethods
   TestRunner.runTests instance (setUp, tearDown) tests
   methodsWithAttribute typeof<TestFixtureTearDownAttribute> |> runMethods
module Tap


 Test Anything Protocol (TAP) NUnit runner
namespace System
namespace System.Collections
namespace System.Reflection
namespace NUnit
namespace NUnit.Framework
type Args = obj []

Full name: Tap.Args
type obj = Object

Full name: Microsoft.FSharp.Core.obj
type ExpectedResult = obj option

Full name: Tap.ExpectedResult
type 'T option = Option<'T>

Full name: Microsoft.FSharp.Core.option<_>
Multiple items
type ExpectedException = Type option

Full name: Tap.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
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
type Timeout = int option

Full name: Tap.Timeout

--------------------
type TimeoutAttribute =
  inherit PropertyAttribute
  new : timeout:int -> TimeoutAttribute

Full name: NUnit.Framework.TimeoutAttribute

--------------------
TimeoutAttribute(timeout: int) : unit
Multiple items
val int : value:'T -> int (requires member op_Explicit)

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

--------------------
type int = int32

Full name: Microsoft.FSharp.Core.int

--------------------
type int<'Measure> = int

Full name: Microsoft.FSharp.Core.int<_>
Multiple items
union case Test.Test: MethodInfo * Args * ExpectedResult * ExpectedException * Timeout -> Test

--------------------
type Test = | Test of MethodInfo * Args * ExpectedResult * ExpectedException * Timeout

Full name: Tap.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
val internal getCustomAttribute : mi:MethodInfo -> #Attribute

Full name: Tap.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 name : string
val t : Type
val pi : PropertyInfo
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
union case Option.Some: Value: 'T -> Option<'T>
PropertyInfo.GetGetMethod() : MethodInfo
PropertyInfo.GetGetMethod(nonPublic: bool) : MethodInfo
union case Option.None: Option<'T>
Type.GetMethod(name: string) : MethodInfo
Type.GetMethod(name: string, bindingAttr: BindingFlags) : MethodInfo
Type.GetMethod(name: string, types: Type []) : MethodInfo
Type.GetMethod(name: string, types: Type [], modifiers: ParameterModifier []) : MethodInfo
Type.GetMethod(name: string, bindingAttr: BindingFlags, binder: Binder, types: Type [], modifiers: ParameterModifier []) : MethodInfo
Type.GetMethod(name: string, bindingAttr: BindingFlags, binder: Binder, callConvention: CallingConventions, types: Type [], modifiers: ParameterModifier []) : MethodInfo
val internal getSourceData : instance:obj * instanceType:Type -> sourceName:string * sourceType:Type -> IEnumerable

Full name: Tap.SourceData.getSourceData
val instance : obj
val instanceType : Type
val sourceName : string
val sourceType : Type
active recognizer SourceProperty: string * Type -> MethodInfo option

Full name: Tap.SourceData.( |SourceProperty|_| )
active recognizer SourceMethod: string * Type -> MethodInfo option

Full name: Tap.SourceData.( |SourceMethod|_| )
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 result : obj
MethodBase.Invoke(obj: obj, parameters: obj []) : obj
MethodBase.Invoke(obj: obj, invokeAttr: BindingFlags, binder: Binder, parameters: obj [], culture: Globalization.CultureInfo) : obj
type IEnumerable =
  member GetEnumerator : unit -> IEnumerator

Full name: System.Collections.IEnumerable
val invalidOp : message:string -> 'T

Full name: Microsoft.FSharp.Core.Operators.invalidOp
type ParameterDataAttribute =
  inherit Attribute
  member GetData : parameter:ParameterInfo -> IEnumerable

Full name: NUnit.Framework.ParameterDataAttribute
module SourceData

from Tap
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.ParameterData.List.combinations
val hs : #seq<'b>
val tss : #seq<'b> list
val h : 'b
val ts : 'b list
val internal tryGetCustomAttribute<'TAttribute (requires 'TAttribute :> Attribute)> : pi:ParameterInfo -> obj option

Full name: Tap.ParameterData.tryGetCustomAttribute
val pi : ParameterInfo
type ParameterInfo =
  member Attributes : ParameterAttributes
  member DefaultValue : obj
  member GetCustomAttributes : inherit:bool -> obj[] + 1 overload
  member GetCustomAttributesData : unit -> IList<CustomAttributeData>
  member GetOptionalCustomModifiers : unit -> Type[]
  member GetRealObject : context:StreamingContext -> obj
  member GetRequiredCustomModifiers : unit -> Type[]
  member IsDefined : attributeType:Type * inherit:bool -> bool
  member IsIn : bool
  member IsLcid : bool
  ...

Full name: System.Reflection.ParameterInfo
Multiple items
type Random =
  new : unit -> Random + 1 overload
  member Next : unit -> int + 2 overloads
  member NextBytes : buffer:byte[] -> unit
  member NextDouble : unit -> float

Full name: System.Random

--------------------
type RandomAttribute =
  inherit ValuesAttribute
  new : count:int -> RandomAttribute + 2 overloads
  member GetData : parameter:ParameterInfo -> IEnumerable

Full name: NUnit.Framework.RandomAttribute

--------------------
Random() : unit
Random(Seed: int) : unit

--------------------
RandomAttribute(count: int) : unit
RandomAttribute(min: float, max: float, count: int) : unit
RandomAttribute(min: int, max: int, count: int) : unit
Multiple items
type RandomAttribute =
  inherit ValuesAttribute
  new : count:int -> RandomAttribute + 2 overloads
  member GetData : parameter:ParameterInfo -> IEnumerable

Full name: NUnit.Framework.RandomAttribute

--------------------
RandomAttribute(count: int) : unit
RandomAttribute(min: float, max: float, count: int) : unit
RandomAttribute(min: int, max: int, count: int) : unit
Multiple items
type RangeAttribute =
  inherit ValuesAttribute
  new : from:int * to:int -> RangeAttribute + 4 overloads

Full name: NUnit.Framework.RangeAttribute

--------------------
RangeAttribute(from: int, to: int) : unit
RangeAttribute(from: int, to: int, step: int) : unit
RangeAttribute(from: int64, to: int64, step: int64) : unit
RangeAttribute(from: float, to: float, step: float) : unit
RangeAttribute(from: float32, to: float32, step: float32) : unit
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
Multiple items
type ValueSourceAttribute =
  inherit Attribute
  new : sourceName:string -> ValueSourceAttribute + 1 overload
  member SourceName : string
  member SourceType : Type

Full name: NUnit.Framework.ValueSourceAttribute

--------------------
ValueSourceAttribute(sourceName: string) : unit
ValueSourceAttribute(sourceType: Type, sourceName: string) : unit
val internal getParameterData : 'a * Type -> pi:ParameterInfo -> obj list

Full name: Tap.ParameterData.getParameterData
val instance : 'a * Type
Multiple items
active recognizer Random: ParameterInfo -> obj option

Full name: Tap.ParameterData.( |Random|_| )

--------------------
type Random =
  new : unit -> Random + 1 overload
  member Next : unit -> int + 2 overloads
  member NextBytes : buffer:byte[] -> unit
  member NextDouble : unit -> float

Full name: System.Random

--------------------
type RandomAttribute =
  inherit ValuesAttribute
  new : count:int -> RandomAttribute + 2 overloads
  member GetData : parameter:ParameterInfo -> IEnumerable

Full name: NUnit.Framework.RandomAttribute

--------------------
Random() : unit
Random(Seed: int) : unit

--------------------
RandomAttribute(count: int) : unit
RandomAttribute(min: float, max: float, count: int) : unit
RandomAttribute(min: int, max: int, count: int) : unit
val rand : obj
val x : obj
Multiple items
active recognizer Range: ParameterInfo -> obj option

Full name: Tap.ParameterData.( |Range|_| )

--------------------
type RangeAttribute =
  inherit ValuesAttribute
  new : from:int * to:int -> RangeAttribute + 4 overloads

Full name: NUnit.Framework.RangeAttribute

--------------------
RangeAttribute(from: int, to: int) : unit
RangeAttribute(from: int, to: int, step: int) : unit
RangeAttribute(from: int64, to: int64, step: int64) : unit
RangeAttribute(from: float, to: float, step: float) : unit
RangeAttribute(from: float32, to: float32, step: float32) : unit
val range : obj
Multiple items
active recognizer Values: ParameterInfo -> obj option

Full name: Tap.ParameterData.( |Values|_| )

--------------------
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 values : obj
Multiple items
active recognizer ValueSource: ParameterInfo -> obj option

Full name: Tap.ParameterData.( |ValueSource|_| )

--------------------
type ValueSourceAttribute =
  inherit Attribute
  new : sourceName:string -> ValueSourceAttribute + 1 overload
  member SourceName : string
  member SourceType : Type

Full name: NUnit.Framework.ValueSourceAttribute

--------------------
ValueSourceAttribute(sourceName: string) : unit
ValueSourceAttribute(sourceType: Type, sourceName: string) : unit
val source : obj
val data : IEnumerable
Multiple items
module ParameterData

from Tap

--------------------
type ParameterDataAttribute =
  inherit Attribute
  member GetData : parameter:ParameterInfo -> IEnumerable

Full name: NUnit.Framework.ParameterDataAttribute
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: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.SourceType: Type
property MemberInfo.DeclaringType: Type
property TestCaseSourceAttribute.SourceName: string
Multiple items
type TestAttribute =
  inherit Attribute
  new : unit -> TestAttribute
  member Description : string with get, set

Full name: NUnit.Framework.TestAttribute

--------------------
TestAttribute() : unit
val internal tryGetExpectedException : mi:MethodInfo -> Type option

Full name: Tap.TestGeneration.tryGetExpectedException
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
property ExpectedExceptionAttribute.ExpectedException: Type
val attr : TimeoutAttribute
Multiple items
type TimeoutAttribute =
  inherit PropertyAttribute
  new : timeout:int -> TimeoutAttribute

Full name: NUnit.Framework.TimeoutAttribute

--------------------
TimeoutAttribute(timeout: int) : unit
property PropertyAttribute.Properties: IDictionary
Multiple items
type MaxTimeAttribute =
  inherit PropertyAttribute
  new : milliseconds:int -> MaxTimeAttribute

Full name: NUnit.Framework.MaxTimeAttribute

--------------------
MaxTimeAttribute(milliseconds: int) : unit
val attr : MaxTimeAttribute
val internal tryGetTimeout : _arg1:MethodInfo -> int option

Full name: Tap.TestGeneration.tryGetTimeout
Multiple items
active recognizer Timeout: MethodInfo -> int option

Full name: Tap.TestGeneration.( |Timeout|_| )

--------------------
type Timeout = int option

Full name: Tap.Timeout

--------------------
type TimeoutAttribute =
  inherit PropertyAttribute
  new : timeout:int -> TimeoutAttribute

Full name: NUnit.Framework.TimeoutAttribute

--------------------
TimeoutAttribute(timeout: int) : unit
val ms : int
Multiple items
active recognizer MaxTime: MethodInfo -> int option

Full name: Tap.TestGeneration.( |MaxTime|_| )

--------------------
type MaxTimeAttribute =
  inherit PropertyAttribute
  new : milliseconds:int -> MaxTimeAttribute

Full name: NUnit.Framework.MaxTimeAttribute

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

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

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

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

Full name: Microsoft.FSharp.Collections.seq<_>
val ex : Type option
val timeout : int option
val case : TestCaseAttribute
val expected : obj option
property TestCaseAttribute.HasExpectedResult: bool
property TestCaseAttribute.ExpectedResult: obj
property TestCaseAttribute.ExpectedException: Type
property TestCaseAttribute.Arguments: obj []
val internal fromData : instance:'a -> mi:MethodInfo -> data:IEnumerable -> Test []

Full name: Tap.TestGeneration.fromData
val instance : 'a
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.ExpectedException: Type
property TestCaseData.Arguments: obj []
val args : obj []
val arg : obj
val internal fromValues : 'a * Type -> mi:MethodInfo -> Test []

Full name: Tap.TestGeneration.fromValues
val ps : ParameterInfo []
MethodBase.GetParameters() : ParameterInfo []
val argValues : obj list list
val xs : obj list list
val args : obj list
val toArray : list:'T list -> 'T []

Full name: Microsoft.FSharp.Collections.List.toArray
val internal generateTests : instance:'a -> mi:MethodInfo -> Test []

Full name: Tap.TestGeneration.generateTests
Multiple items
active recognizer Ignore: MethodInfo -> unit option

Full name: Tap.TestGeneration.( |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.TestGeneration.( |TestCases|_| )
Multiple items
active recognizer TestCaseSource: MethodInfo -> (string * Type) option

Full name: Tap.TestGeneration.( |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 source : string * Type
active recognizer VanillaTest: MethodInfo -> unit option

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

Full name: Tap.TestRunner.runTest
val args : Args
val expected : ExpectedResult
val exType : ExpectedException
val timeout : Timeout
val actual : obj
Multiple items
type Async
static member AsBeginEnd : computation:('Arg -> Async<'T>) -> ('Arg * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * (IAsyncResult -> unit)
static member AwaitEvent : event:IEvent<'Del,'T> * ?cancelAction:(unit -> unit) -> Async<'T> (requires delegate and 'Del :> Delegate)
static member AwaitIAsyncResult : iar:IAsyncResult * ?millisecondsTimeout:int -> Async<bool>
static member AwaitTask : task:Task<'T> -> Async<'T>
static member AwaitWaitHandle : waitHandle:WaitHandle * ?millisecondsTimeout:int -> Async<bool>
static member CancelDefaultToken : unit -> unit
static member Catch : computation:Async<'T> -> Async<Choice<'T,exn>>
static member FromBeginEnd : beginAction:(AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg:'Arg1 * beginAction:('Arg1 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * beginAction:('Arg1 * 'Arg2 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * arg3:'Arg3 * beginAction:('Arg1 * 'Arg2 * 'Arg3 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromContinuations : callback:(('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T>
static member Ignore : computation:Async<'T> -> Async<unit>
static member OnCancel : interruption:(unit -> unit) -> Async<IDisposable>
static member Parallel : computations:seq<Async<'T>> -> Async<'T []>
static member RunSynchronously : computation:Async<'T> * ?timeout:int * ?cancellationToken:CancellationToken -> 'T
static member Sleep : millisecondsDueTime:int -> Async<unit>
static member Start : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
static member StartAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions * ?cancellationToken:CancellationToken -> Task<'T>
static member StartChild : computation:Async<'T> * ?millisecondsTimeout:int -> Async<Async<'T>>
static member StartChildAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions -> Async<Task<'T>>
static member StartImmediate : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
static member StartWithContinuations : computation:Async<'T> * continuation:('T -> unit) * exceptionContinuation:(exn -> unit) * cancellationContinuation:(OperationCanceledException -> unit) * ?cancellationToken:CancellationToken -> unit
static member SwitchToContext : syncContext:SynchronizationContext -> Async<unit>
static member SwitchToNewThread : unit -> Async<unit>
static member SwitchToThreadPool : unit -> Async<unit>
static member TryCancelled : computation:Async<'T> * compensation:(OperationCanceledException -> unit) -> Async<'T>
static member CancellationToken : Async<CancellationToken>
static member DefaultCancellationToken : CancellationToken

Full name: Microsoft.FSharp.Control.Async

--------------------
type Async<'T>

Full name: Microsoft.FSharp.Control.Async<_>
static member Async.RunSynchronously : computation:Async<'T> * ?timeout:int * ?cancellationToken:Threading.CancellationToken -> 'T
val async : AsyncBuilder

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.async
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
property Exception.InnerException: exn
Multiple items
type SuccessException =
  inherit Exception
  new : message:string -> SuccessException + 1 overload

Full name: NUnit.Framework.SuccessException

--------------------
SuccessException(message: string) : unit
SuccessException(message: string, inner: exn) : unit
Exception.GetType() : Type
val internal color : c:ConsoleColor -> IDisposable

Full name: Tap.TestRunner.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.TestRunner.showResult
val number : int
val error : 'a option
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: Generic.IEnumerable<string>) : string
String.Join<'T>(separator: string, values: 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 -> setUp:(unit -> unit) * tearDown:(unit -> unit) -> tests:Test [] -> unit

Full name: Tap.TestRunner.runTests
val setUp : (unit -> unit)
val tearDown : (unit -> unit)
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
val result : exn option
val Run : testType:Type -> unit

Full name: Tap.Run
val testType : Type
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 []
module TestGeneration

from Tap
val methodsWithAttribute : ('a -> MethodInfo [])
val attr : 'a
val filter : predicate:('T -> bool) -> array:'T [] -> 'T []

Full name: Microsoft.FSharp.Collections.Array.filter
val runMethods : (MethodInfo [] -> unit)
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
val setUps : MethodInfo []
Multiple items
type SetUpAttribute =
  inherit Attribute
  new : unit -> SetUpAttribute

Full name: NUnit.Framework.SetUpAttribute

--------------------
SetUpAttribute() : unit
val tearDowns : MethodInfo []
Multiple items
type TestFixtureSetUpAttribute =
  inherit Attribute
  new : unit -> TestFixtureSetUpAttribute

Full name: NUnit.Framework.TestFixtureSetUpAttribute

--------------------
TestFixtureSetUpAttribute() : unit
module TestRunner

from Tap
Multiple items
type TestFixtureTearDownAttribute =
  inherit Attribute
  new : unit -> TestFixtureTearDownAttribute

Full name: NUnit.Framework.TestFixtureTearDownAttribute

--------------------
TestFixtureTearDownAttribute() : unit

More information

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