vendredi 13 novembre 2015

F#: UnitTest case failled

Consider i have a function like newConvert. I am sopposed to recieve an error for newCovertor("IL") . To generate this erorr: I used failwith "Invalid Input"

The erorr is :

System.Exception: Invalid Input
>    at FSI_0160.inputChecker(FSharpList`1 numberList) in C:\Users\Salman\Desktop\coursework6input\itt8060-master\coursework6input\BrokenRomanNumbers\Library1.fs:line 140
   at FSI_0160.newCovertor(String romanNumber) in C:\Users\Salman\Desktop\coursework6input\itt8060-master\coursework6input\BrokenRomanNumbers\Library1.fs:line 147
   at <StartupCode$FSI_0165>.$FSI_0165.main@() in C:\Users\Salman\Desktop\coursework6input\itt8060-master\coursework6input\BrokenRomanNumbers\newtest.fs:line 32
Stopped due to error

I used FsUnit and Nunit, they are loaded and installed and working rightly. Then I made a tes for it using

[<TestFixture>]
type ``Given a Roman number15 ``()=



         [<Test>]
         member this.
               ``Whether the right convert for this number must be exist``()=
                  newCovertor("IL") |> should equal System.Exception

I cannot understand!! The function fails rightly, but the test does not accept it, so why??????

Aucun commentaire:

Enregistrer un commentaire