From cef2a20f7a03576c1245428963246b7be71c7991 Mon Sep 17 00:00:00 2001 From: Sven van Heugten Date: Mon, 5 Jan 2026 21:54:34 +0100 Subject: [PATCH] Remove some ambiguity --- NightLight.Core.Tests/FakeHome.fs | 14 +++++++------- NightLight.Core.Tests/InteractionListGenerators.fs | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/NightLight.Core.Tests/FakeHome.fs b/NightLight.Core.Tests/FakeHome.fs index 3facd72..d01c935 100644 --- a/NightLight.Core.Tests/FakeHome.fs +++ b/NightLight.Core.Tests/FakeHome.fs @@ -7,8 +7,8 @@ open FsToolkit.ErrorHandling open FSharp.Data type HumanInteraction = - | LightTurnedOn of Light - | LightTurnedOff of Light + | LightPoweredOn of Light + | LightPoweredOff of Light type Interaction = | HumanInteraction of HumanInteraction @@ -30,9 +30,9 @@ type FakeLight(light: Light) = member _.LightWithState = light, if hasPower then On(brightness, color) else Off - member _.TurnOn() = hasPower <- true + member _.PowerOn() = hasPower <- true - member _.TurnOff() = hasPower <- false + member _.PowerOff() = hasPower <- false member _.SetBrightness(newBrightness: byte) = if hasPower then @@ -91,8 +91,8 @@ type FakeHome() = member _.Interact(interaction: Interaction) = match interaction with - | HumanInteraction(LightTurnedOn light) -> - friendlyNameToFakeLight[light.FriendlyName].TurnOn() + | HumanInteraction(LightPoweredOn light) -> + friendlyNameToFakeLight[light.FriendlyName].PowerOn() { Topic = "zigbee2mqtt/bridge/event" Payload = @@ -102,7 +102,7 @@ type FakeHome() = }}" } |> ReceivedZigbeeEvent |> onEventPublished.Trigger - | HumanInteraction(LightTurnedOff light) -> friendlyNameToFakeLight[light.FriendlyName].TurnOff() + | HumanInteraction(LightPoweredOff light) -> friendlyNameToFakeLight[light.FriendlyName].PowerOff() | TimeChanged newTime -> newTime |> Event.TimeChanged |> onEventPublished.Trigger type FakeHome with diff --git a/NightLight.Core.Tests/InteractionListGenerators.fs b/NightLight.Core.Tests/InteractionListGenerators.fs index 5d620f3..17fd21e 100644 --- a/NightLight.Core.Tests/InteractionListGenerators.fs +++ b/NightLight.Core.Tests/InteractionListGenerators.fs @@ -10,7 +10,7 @@ let private genTimeChangedInteraction = let private genHumanInteraction = Gen.elements lights |> Gen.bind (fun light -> - [ LightTurnedOn light; LightTurnedOff light ] + [ LightPoweredOn light; LightPoweredOff light ] |> Gen.elements |> Gen.map Interaction.HumanInteraction)