Reorganize types to prepare for unit testing
This commit is contained in:
parent
5219abfb4b
commit
83b716a509
7 changed files with 52 additions and 62 deletions
|
|
@ -1,20 +1,35 @@
|
|||
module internal NightLight.Core.Moods
|
||||
|
||||
open NightLight.Core.PartsOfDay
|
||||
open NightLight.Core.Models
|
||||
|
||||
type Mood =
|
||||
| White
|
||||
| Yellow
|
||||
| Red
|
||||
|
||||
type Room =
|
||||
| Bathroom
|
||||
| LivingRoom
|
||||
| Bedroom
|
||||
|
||||
let getDesiredMood room partOfDay =
|
||||
match room, partOfDay with
|
||||
| Bathroom, Day -> White
|
||||
| LivingRoom, Day -> Yellow
|
||||
| Bedroom, Day -> Yellow
|
||||
| _, Night -> Red
|
||||
|
||||
type Color =
|
||||
| ColorByCoordinates of float * float
|
||||
| ColorByTemperature of int
|
||||
|
||||
type Brightness = Brightness of int
|
||||
|
||||
let getDesiredColorAndBrightness bulb mood =
|
||||
let white = ColorByCoordinates(0.3227, 0.329)
|
||||
let yellow = ColorByTemperature 454
|
||||
let red = ColorByCoordinates(0.6942, 0.2963)
|
||||
|
||||
match bulb, mood with
|
||||
| IkeaBulb, White -> white, Brightness 254
|
||||
| IkeaBulb, Yellow -> yellow, Brightness 210
|
||||
| IkeaBulb, Red -> red, Brightness 254
|
||||
| PaulmannBulb, White -> white, Brightness 35
|
||||
| PaulmannBulb, Yellow -> yellow, Brightness 35
|
||||
| PaulmannBulb, Red -> red, Brightness 80
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue