Skip to content

Commit

Permalink
Improve tests: HigherOrderAssertions
Browse files Browse the repository at this point in the history
  • Loading branch information
Christer van der Meeren committed Sep 1, 2023
1 parent 38701e1 commit 567a490
Showing 1 changed file with 31 additions and 13 deletions.
44 changes: 31 additions & 13 deletions src/Faqt.Tests/HigherOrderAssertions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@ module Satisfy =


[<Fact>]
let ``Passes if the inner assertion passes and can be chained with And`` () =
let ``Can be chained with And`` () =
"asd"
.Should()
.Satisfy(fun x -> x.Should().Pass())
.Id<And<string>>()
.And.Be("asd")


[<Fact>]
let ``Passes if the inner assertion passes`` () =
"asd".Should().Satisfy(fun x -> x.Should().Pass())


[<Fact>]
let ``Fails with expected message if the inner assertion fails`` () =
fun () -> "asd".Length.Should().Satisfy(fun x -> x.ToString().Length.Should().Fail())
Expand Down Expand Up @@ -47,14 +52,19 @@ module NotSatisfy =


[<Fact>]
let ``Passes if the inner assertion fails and can be chained with And`` () =
let ``Can be chained with And`` () =
"asd"
.Should()
.NotSatisfy(fun x -> x.Should().Fail())
.Id<And<string>>()
.And.Be("asd")


[<Fact>]
let ``Passes if the inner assertion fails`` () =
"asd".Should().NotSatisfy(fun x -> x.Should().Fail())


[<Fact>]
let ``Fails with expected message if the inner assertion passes`` () =
fun () -> "asd".Should().NotSatisfy(fun x -> x.Should().Pass())
Expand All @@ -80,7 +90,16 @@ module SatisfyAll =


[<Fact>]
let ``Passes if all of the inner assertions passes and can be chained with And`` () =
let ``Can be chained with And`` () =
"asd".Should().SatisfyAll([]).Id<And<string>>().And.Be("asd")


[<Fact>]
let ``Passes if assertion list is empty`` () = "asd".Should().SatisfyAll([])


[<Fact>]
let ``Passes if all of the inner assertions passes`` () =
"asd"
.Should()
.SatisfyAll(
Expand All @@ -94,10 +113,6 @@ module SatisfyAll =
.And.Be("asd")


[<Fact>]
let ``Passes if assertion list is empty`` () = "asd".Should().SatisfyAll([])


[<Fact>]
let ``Fails with expected message if at least one of the inner assertions fail`` () =
fun () ->
Expand Down Expand Up @@ -160,18 +175,21 @@ module SatisfyAny =


[<Fact>]
let ``Passes if all of the inner assertions passes and can be chained with And`` () =
"asd"
.Should()
.SatisfyAny([ (fun s1 -> s1.Length.Should().Pass()); (fun s2 -> s2.Length.Should().Pass()) ])
.Id<And<string>>()
.And.Be("asd")
let ``Can be chained with And`` () =
"asd".Should().SatisfyAny([]).Id<And<string>>().And.Be("asd")


[<Fact>]
let ``Passes if assertion list is empty`` () = "asd".Should().SatisfyAny([])


[<Fact>]
let ``Passes if all of the inner assertions passes`` () =
"asd"
.Should()
.SatisfyAny([ (fun s1 -> s1.Length.Should().Pass()); (fun s2 -> s2.Length.Should().Pass()) ])


[<Fact>]
let ``Passes if only one of the inner assertions passes 1`` () =
"asd"
Expand Down

0 comments on commit 567a490

Please sign in to comment.