-
Notifications
You must be signed in to change notification settings - Fork 0
/
Section_11_Tests.fs
28 lines (22 loc) · 1.03 KB
/
Section_11_Tests.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
namespace FPinFSharp.Chapter_02.UnitTests
open System
open FPinFSharp.Chapter_02.Section_11
open Shouldly
open Xunit
module Section_11_Tests =
[<Fact>]
let ``GIVEN true WHEN raiseExceptionIfTrue THEN InvalidOperationException is thrown`` () =
let action = fun () -> raiseExceptionIfTrue true
action |> ShouldThrowExtensions.ShouldThrow<InvalidOperationException>
[<Fact>]
let ``GIVEN false WHEN raiseExceptionIfTrue THEN no exception is thrown`` () =
let action = fun () -> raiseExceptionIfTrue false
action |> ShouldThrowExtensions.ShouldNotThrow
[<Fact>]
let ``GIVEN false WHEN raiseExceptionIfFalse THEN InvalidOperationException is thrown`` () =
let action = fun () -> raiseExceptionIfFalse false
action |> ShouldThrowExtensions.ShouldThrow<InvalidOperationException>
[<Fact>]
let ``GIVEN true WHEN raiseExceptionIfFalse THEN no exception is thrown`` () =
let action = fun () -> raiseExceptionIfFalse true
action |> ShouldThrowExtensions.ShouldNotThrow