Stop propagating parse errors throughout the tests
This commit is contained in:
parent
109ebde64a
commit
a741938f89
3 changed files with 22 additions and 25 deletions
|
|
@ -11,12 +11,18 @@ type NightLightStateMachine(now: DateTime) =
|
|||
|
||||
let transmittedCommands = new List<Message>()
|
||||
|
||||
let assertIsOk (result: Result<unit, 'a>) : unit =
|
||||
match result with
|
||||
| Ok() -> ()
|
||||
| Error error -> failwith $"Expected Ok, got Error {error}"
|
||||
|
||||
let sendEvent event =
|
||||
result {
|
||||
let! newState, commands = onEventReceived state event
|
||||
state <- newState
|
||||
transmittedCommands.AddRange commands
|
||||
}
|
||||
|> assertIsOk
|
||||
|
||||
member _.TransmittedCommands = transmittedCommands.AsReadOnly()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue