Put Arbitraries on the entire test class

This commit is contained in:
Sven van Heugten 2026-01-04 10:31:13 +01:00
parent c7c5de9e21
commit 6baf725765

View file

@ -1,14 +1,16 @@
module NightLight.Core.Tests.NightLightTests namespace NightLight.Core.Tests
open FsCheck.Xunit open FsCheck.Xunit
[<Property(Arbitrary = [| typeof<Arbitraries> |])>] [<Properties(Arbitrary = [| typeof<Arbitraries> |])>]
let ``Brightness should always be under 255`` (fakeHome: FakeHome) (interactions: Interaction list) = type NightLightTests() =
interactions |> Seq.iter (fun interaction -> fakeHome.Interact interaction) [<Property>]
let ``Brightness should always be under 255`` (fakeHome: FakeHome) (interactions: Interaction list) =
interactions |> Seq.iter (fun interaction -> fakeHome.Interact interaction)
fakeHome.LightStates fakeHome.LightStates
|> Seq.choose (fun (_, state) -> |> Seq.choose (fun (_, state) ->
match state with match state with
| On brightness -> Some brightness | On brightness -> Some brightness
| Off -> None) | Off -> None)
|> Seq.forall (fun brightness -> brightness < 255uy) |> Seq.forall (fun brightness -> brightness < 255uy)