Introduce ensureLastRemoteInteractionIs
This commit is contained in:
parent
b3689108a7
commit
d509829304
2 changed files with 23 additions and 8 deletions
|
|
@ -67,3 +67,22 @@ let ensurePartOfDayIs (desiredPartOfDay: PartOfDay) (genInteractions: Gen<Intera
|
|||
desiredPartOfDay
|
||||
|> genTimeChangedToPartOfDay
|
||||
|> Gen.map (fun tc -> interactions @ [ tc ]))
|
||||
|
||||
let ensureLastRemoteInteractionIs
|
||||
(desiredLastRemoteInteraction: RemoteInteraction)
|
||||
(genInteractions: Gen<Interaction list>)
|
||||
=
|
||||
genInteractions
|
||||
|> Gen.map (fun interactions ->
|
||||
let maybeLastRemoteInteraction =
|
||||
interactions
|
||||
|> Seq.choose (fun interaction ->
|
||||
match interaction with
|
||||
| Interaction.RemoteInteraction remoteInteraction -> Some remoteInteraction
|
||||
| _ -> None)
|
||||
|> Seq.tryLast
|
||||
|
||||
if maybeLastRemoteInteraction = Some desiredLastRemoteInteraction then
|
||||
interactions
|
||||
else
|
||||
interactions @ [ RemoteInteraction desiredLastRemoteInteraction ])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue