fitSharp
Compare Exception
The Compare Exception operator specifies an exception as an expected value. We can check the exception message, the exception type name (no namespace), or both:
when input is
story test fixture
checkplain test'sample domain'

|compute
message throw
'oh no' 'exception["oh no"]'
oops exception[ApplicationException]
null exception[NullReferenceException]
help 'exception[ApplicationException: "help"]'
OK exception[ApplicationException]

check throw 'oh no' 'exception["oh no"]'
sample domain

compute
message throw
oh no exception["oh no"]
oops exception[ApplicationException]
null exception[NullReferenceException]
help exception[ApplicationException: "help"]
OK exception[ApplicationException] expected
OK actual

check throw oh no exception["oh no"]
'sample domain'

|compute
message throw
'oh no' 'exception["oh no"]'
oops exception[ApplicationException]
null exception[NullReferenceException]
help 'exception[ApplicationException: "help"]'
OK exception[ApplicationException]

check throw 'oh no' 'exception["oh no"]'
then output is
sample domain

compute
message throw
oh no exception["oh no"]
oops exception[ApplicationException]
null exception[NullReferenceException]
help exception[ApplicationException: "help"]
OK exception[ApplicationException] expected
OK actual

check throw oh no exception["oh no"]
© Copyright Syterra Software Inc. All rights reserved.