Skip to content

Commit

Permalink
Remove usage of NUnit APIs not available in internal build
Browse files Browse the repository at this point in the history
  • Loading branch information
latkin committed Feb 27, 2015
1 parent aa3111c commit 62fccd8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
12 changes: 11 additions & 1 deletion vsintegration/src/unittests/TestLib.Utils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,17 @@ module Asserts =
let message = sprintf "Expected S_OK"
printfn "%s" message
Assert.Fail(message)

let Throws<'T when 'T:> Exception> f =
let error =
try
f ()
Some(sprintf "No exception occurred, expected %O" typeof<'T>)
with
| :? 'T -> None
| e -> Some(sprintf "Wrong exception type occurred. Got %O, expecting %O" (e.GetType()) typeof<'T>)
match error with
| Some(msg) -> Assert.Fail(msg)
| None -> ()

module UIStuff =
let SetupSynchronizationContext() =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -774,9 +774,8 @@ type Utilities() =
Assert.AreEqual(255L, ProjectNode.ParsePropertyValueToInt64("0xFF"))
Assert.AreEqual(null, ProjectNode.ParsePropertyValueToInt64(""))
Assert.AreEqual(null, ProjectNode.ParsePropertyValueToInt64(null))
Assert.Throws<Exception>(fun () -> ignore (ProjectNode.ParsePropertyValueToInt64("abc"))) |> ignore
Assert.Throws<Exception>(fun () -> ignore (ProjectNode.ParsePropertyValueToInt64("12333333333333333333333333"))) |> ignore

Throws<Exception>(fun () -> ignore (ProjectNode.ParsePropertyValueToInt64("abc")))
Throws<Exception>(fun () -> ignore (ProjectNode.ParsePropertyValueToInt64("12333333333333333333333333")))

#if DEBUGGERVISUALIZER
module internal DebugViz =
Expand Down

0 comments on commit 62fccd8

Please sign in to comment.