Add test for light brightness
This commit is contained in:
parent
001b1e0af3
commit
275a0677eb
1 changed files with 17 additions and 0 deletions
|
|
@ -40,6 +40,23 @@ type NightLightTests() =
|
|||
|> Prop.collect $"{fakeHome.LightsThatAreOn.Length} light(s) on"
|
||||
|> Prop.trivial (fakeHome.LightsThatAreOn.Length = 0)
|
||||
|
||||
[<Property(Arbitrary = [| typeof<ArbitraryInteractions> |])>]
|
||||
let ``All lights should either be off or have a brightness that fits its color`` (interactions: Interaction list) =
|
||||
let fakeHome = createFakeHomeWithNightLightAndInteract interactions
|
||||
|
||||
fakeHome.LightStates
|
||||
|> Seq.forall (function
|
||||
| _, Off
|
||||
| { Bulb = IkeaBulb }, On(254uy, White) -> true
|
||||
| { Bulb = IkeaBulb }, On(210uy, Yellow) -> true
|
||||
| { Bulb = IkeaBulb }, On(254uy, Red) -> true
|
||||
| { Bulb = PaulmannBulb }, On(35uy, White) -> true
|
||||
| { Bulb = PaulmannBulb }, On(35uy, Yellow) -> true
|
||||
| { Bulb = PaulmannBulb }, On(80uy, Red) -> true
|
||||
| _ -> false)
|
||||
|> Prop.collect $"{fakeHome.LightsThatAreOn.Length} light(s) on"
|
||||
|> Prop.trivial (fakeHome.LightsThatAreOn.Length = 0)
|
||||
|
||||
[<Property(Arbitrary = [| typeof<ArbitraryInteractions> |])>]
|
||||
let ``All non-remotely controlled lights with power should be on`` (interactions: Interaction list) =
|
||||
let fakeHome = createFakeHomeWithNightLightAndInteract interactions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue