Skip to content

Commit 3651a5d

Browse files
committed
Apply suggestions from code review.
1 parent d7fc3dc commit 3651a5d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/FsUnit.NUnit/CustomConstraints.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ module CustomConstraints =
1717
let result = Common.isOfCase this.Expected actual
1818
ConstraintResult(this, actual, result)
1919
else
20-
failwith "Value (not expression) is not a union case."
20+
failwith $"Value (not expression) is not a union case. Got a {actual.GetType().Name}."

src/FsUnit.Xunit/CustomMatchers.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@ let instanceOfType<'a> =
185185
let contain expected =
186186
let matches(actual: obj) =
187187
match actual with
188-
| :? list<_> as l -> l |> List.exists(fun i -> i = expected)
189-
| :? array<_> as a -> a |> Array.exists(fun i -> i = expected)
190-
| :? seq<_> as s -> s |> Seq.exists(fun i -> i = expected)
191-
| :? IEnumerable as e -> e |> Seq.cast |> Seq.exists(fun i -> i = expected)
188+
| :? list<_> as l -> l |> List.exists((=) expected)
189+
| :? array<_> as a -> a |> Array.exists((=) expected)
190+
| :? seq<_> as s -> s |> Seq.exists((=) expected)
191+
| :? IEnumerable as e -> e |> Seq.cast |> Seq.exists((=) expected)
192192
| _ -> false
193193

194194
CustomMatcher<obj>($"Contains %A{expected}", Func<_, _> matches)

tests/FsUnit.NUnit.Test/beOfCaseTests.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type ``be ofCase tests``() =
4343
[<Test>]
4444
member _.``Given a non-union case as value argument throws an exception``() =
4545
(fun () -> 5 |> should not' (be ofCase <@ Second 5 @>) |> ignore)
46-
|> should (throwWithMessage "Value (not expression) is not a union case.") typeof<System.Exception>
46+
|> should (throwWithMessage "Value (not expression) is not a union case. Got a Int32.") typeof<System.Exception>
4747

4848
[<Test>]
4949
member _.``None should be ofCase None``() =

0 commit comments

Comments
 (0)