Make the Right button toggle the living room lights
This commit is contained in:
parent
1dc1faa16a
commit
48c58b610c
3 changed files with 17 additions and 6 deletions
|
|
@ -96,11 +96,13 @@ type NightLightTests() =
|
|||
let newDayStartedSinceBedroomRemote =
|
||||
hasNewDayStartedSince interactions lastBedroomControllingRemoteInteraction
|
||||
|
||||
let hasPressedRight =
|
||||
let livingRoomLightsToggledOn =
|
||||
interactions
|
||||
|> Seq.exists (function
|
||||
|> Seq.filter (function
|
||||
| Interaction.LivingRoomControllingRemoteInteraction RemotePressedRightButton -> true
|
||||
| _ -> false)
|
||||
|> Seq.length
|
||||
|> fun rightPresses -> rightPresses % 2 = 0
|
||||
|
||||
let isExpectedOn light =
|
||||
match light with
|
||||
|
|
@ -115,15 +117,15 @@ type NightLightTests() =
|
|||
| Some(_, RemotePressedOnButton) -> true
|
||||
| None -> true
|
||||
| LivingRoomWallLamp
|
||||
| LivingRoomFloorLamp -> not hasPressedRight
|
||||
| LivingRoomFloorLamp -> livingRoomLightsToggledOn
|
||||
| BathroomCeilingLamp -> true
|
||||
|
||||
lightsWithPower
|
||||
|> Seq.forall (fun (light, state) -> state.IsOn = isExpectedOn light)
|
||||
|> Prop.collect
|
||||
$"last bedroom controlling remote interaction is {lastBedroomControllingRemoteInteraction |> Option.map snd}"
|
||||
|> Prop.collect $"pressed right: {hasPressedRight}"
|
||||
|> Prop.collect $"{lightsWithPower.Length} light(s) with power"
|
||||
|> Prop.classify livingRoomLightsToggledOn "living room lights toggled on"
|
||||
|> Prop.classify newDayStartedSinceBedroomRemote "new day since bedroom remote"
|
||||
|> Prop.label fakeHome.Label
|
||||
|> Prop.trivial (lightsWithPower.Length = 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue