O'Reilly logo

Testing with F# by Mikael Lundin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Asserting only one thing in your test

Let us take a look at the following code:

// don't [<Test>] let ``username and password cannot be empty string`` () = // arrange let credentials = Credentials(System.String.Empty, System.String.Empty) // act let result = validate(credentials) // assert result |> should contain UserNameEmpty result |> should contain PasswordEmpty // do [<Test>] let ``username cannot be empty string`` () = // arrange let credentials = Credentials(System.String.Empty, "secret") // act let result = validate(credentials) // assert result |> should contain UserNameEmpty // do [<Test>] let ``password cannot be empty string`` () = // arrange let credentials = Credentials("user", System.String.Empty) // act let result = validate(credentials) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required