Last active
December 20, 2015 08:09
-
-
Save bpatra/6098656 to your computer and use it in GitHub Desktop.
F#ception. test execution with factorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[<TestClass>] | |
type FsCeptionTests () = | |
[<TestMethod>] | |
member this.WithFactorial () = | |
let myTest = "module dafuq | |
let rec factorial n = | |
match n with | |
| 0 -> 1 | |
| 1 -> 1 | |
| _ -> n*factorial(n-1) | |
let x= factorial 5 | |
" | |
let codDomPath = @"<yourPath>\FSharp.Compiler.CodeDom.dll" | |
let psCode = FsToPs codDomPath myTest "dafuq" "x" | |
let result = ExecPsScript<int> psCode | |
Assert.AreEqual(120,result) | |
() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment