Skip to content

Commit 62fccd8

Browse files
committed
Remove usage of NUnit APIs not available in internal build
1 parent aa3111c commit 62fccd8

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

vsintegration/src/unittests/TestLib.Utils.fs

+11-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,17 @@ module Asserts =
3535
let message = sprintf "Expected S_OK"
3636
printfn "%s" message
3737
Assert.Fail(message)
38-
38+
let Throws<'T when 'T:> Exception> f =
39+
let error =
40+
try
41+
f ()
42+
Some(sprintf "No exception occurred, expected %O" typeof<'T>)
43+
with
44+
| :? 'T -> None
45+
| e -> Some(sprintf "Wrong exception type occurred. Got %O, expecting %O" (e.GetType()) typeof<'T>)
46+
match error with
47+
| Some(msg) -> Assert.Fail(msg)
48+
| None -> ()
3949

4050
module UIStuff =
4151
let SetupSynchronizationContext() =

vsintegration/src/unittests/Tests.ProjectSystem.Miscellaneous.fs

+2-3
Original file line numberDiff line numberDiff line change
@@ -774,9 +774,8 @@ type Utilities() =
774774
Assert.AreEqual(255L, ProjectNode.ParsePropertyValueToInt64("0xFF"))
775775
Assert.AreEqual(null, ProjectNode.ParsePropertyValueToInt64(""))
776776
Assert.AreEqual(null, ProjectNode.ParsePropertyValueToInt64(null))
777-
Assert.Throws<Exception>(fun () -> ignore (ProjectNode.ParsePropertyValueToInt64("abc"))) |> ignore
778-
Assert.Throws<Exception>(fun () -> ignore (ProjectNode.ParsePropertyValueToInt64("12333333333333333333333333"))) |> ignore
779-
777+
Throws<Exception>(fun () -> ignore (ProjectNode.ParsePropertyValueToInt64("abc")))
778+
Throws<Exception>(fun () -> ignore (ProjectNode.ParsePropertyValueToInt64("12333333333333333333333333")))
780779

781780
#if DEBUGGERVISUALIZER
782781
module internal DebugViz =

0 commit comments

Comments
 (0)