-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathHelpers.fs
More file actions
27 lines (18 loc) · 881 Bytes
/
Helpers.fs
File metadata and controls
27 lines (18 loc) · 881 Bytes
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
[<AutoOpenAttribute>]
module FSharpKoans.Core.Helpers
open System
open NUnit.Framework
let inline __<'T> : 'T = failwith "Seek wisdom by filling in the __"
type FILL_ME_IN =
class end
type FILL_IN_THE_EXCEPTION() =
inherit Exception()
let AssertWithMessage (x : bool) message = Assert.IsTrue(x, message)
let inline AssertEquality (x:'T) (y:'T) =
match box y with
| :? System.Type as t when t = typeof<FILL_ME_IN> -> failwith "Seek wisdom by correcting the type FILL_ME_IN"
| :? System.Type as t when t = typeof<FILL_IN_THE_EXCEPTION> -> failwith "Seek wisdom by correcting the type FILL_IN_THE_EXCEPTION"
| _ -> Assert.AreEqual(x,y)
let AssertInequality (x:'T) (y:'T) = Assert.AreNotEqual(x,y)
let AssertThrows<'a when 'a :> exn> action = Assert.Throws<'a>(fun () -> action())
let Assert (x : bool) = Assert.IsTrue(x)