Mark trivial test cases
This commit is contained in:
parent
d3c0881c39
commit
f42a8747dd
1 changed files with 13 additions and 2 deletions
|
|
@ -33,6 +33,9 @@ type NightLightTests() =
|
||||||
|> Seq.tryLast
|
|> Seq.tryLast
|
||||||
|> Option.defaultValue false
|
|> Option.defaultValue false
|
||||||
|
|
||||||
|
let filterToLightsWithPower interactions lights =
|
||||||
|
lights |> Seq.filter (fst >> doesLightHavePowerAfter interactions)
|
||||||
|
|
||||||
[<Property>]
|
[<Property>]
|
||||||
let ``All lights that are on should be white or yellow during the day`` () =
|
let ``All lights that are on should be white or yellow during the day`` () =
|
||||||
genTimeChangedToDay
|
genTimeChangedToDay
|
||||||
|
|
@ -41,7 +44,9 @@ type NightLightTests() =
|
||||||
|> Prop.forAll
|
|> Prop.forAll
|
||||||
<| fun interactions ->
|
<| fun interactions ->
|
||||||
let fakeHome = createFakeHomeWithNightLightAndInteract interactions
|
let fakeHome = createFakeHomeWithNightLightAndInteract interactions
|
||||||
|
|
||||||
fakeHome.ForAllLightsThatAreOn(fun (_, _, color) -> color = White || color = Yellow)
|
fakeHome.ForAllLightsThatAreOn(fun (_, _, color) -> color = White || color = Yellow)
|
||||||
|
|> Prop.trivial (fakeHome.LightStates |> Seq.filter (snd >> _.IsOn) |> Seq.isEmpty)
|
||||||
|
|
||||||
[<Property>]
|
[<Property>]
|
||||||
let ``All lights that are on should be red during the night`` () =
|
let ``All lights that are on should be red during the night`` () =
|
||||||
|
|
@ -51,7 +56,9 @@ type NightLightTests() =
|
||||||
|> Prop.forAll
|
|> Prop.forAll
|
||||||
<| fun interactions ->
|
<| fun interactions ->
|
||||||
let fakeHome = createFakeHomeWithNightLightAndInteract interactions
|
let fakeHome = createFakeHomeWithNightLightAndInteract interactions
|
||||||
|
|
||||||
fakeHome.ForAllLightsThatAreOn(fun (_, _, color) -> color = Red)
|
fakeHome.ForAllLightsThatAreOn(fun (_, _, color) -> color = Red)
|
||||||
|
|> Prop.trivial (fakeHome.LightStates |> Seq.filter (snd >> _.IsOn) |> Seq.isEmpty)
|
||||||
|
|
||||||
[<Property>]
|
[<Property>]
|
||||||
let ``After pressing 'On' on the remote, the remotely controlled lights that have power should be on until they are powered off or 'Off' is pressed``
|
let ``After pressing 'On' on the remote, the remotely controlled lights that have power should be on until they are powered off or 'Off' is pressed``
|
||||||
|
|
@ -65,11 +72,12 @@ type NightLightTests() =
|
||||||
|> Prop.forAll
|
|> Prop.forAll
|
||||||
<| fun interactions ->
|
<| fun interactions ->
|
||||||
let fakeHome = createFakeHomeWithNightLightAndInteract interactions
|
let fakeHome = createFakeHomeWithNightLightAndInteract interactions
|
||||||
|
let lightsWithPower = fakeHome.LightStates |> filterToLightsWithPower interactions
|
||||||
|
|
||||||
fakeHome.LightStates
|
lightsWithPower
|
||||||
|> Seq.filter (fst >> doesLightHavePowerAfter interactions)
|
|
||||||
|> Seq.map snd
|
|> Seq.map snd
|
||||||
|> Seq.forall _.IsOn
|
|> Seq.forall _.IsOn
|
||||||
|
|> Prop.trivial (Seq.isEmpty lightsWithPower)
|
||||||
|
|
||||||
[<Property>]
|
[<Property>]
|
||||||
let ``After pressing 'Off' on the remote, the remotely controlled lights should stay off until 'On' is pressed``
|
let ``After pressing 'Off' on the remote, the remotely controlled lights should stay off until 'On' is pressed``
|
||||||
|
|
@ -82,4 +90,7 @@ type NightLightTests() =
|
||||||
|> Prop.forAll
|
|> Prop.forAll
|
||||||
<| fun interactions ->
|
<| fun interactions ->
|
||||||
let fakeHome = createFakeHomeWithNightLightAndInteract interactions
|
let fakeHome = createFakeHomeWithNightLightAndInteract interactions
|
||||||
|
let lightsWithPower = fakeHome.LightStates |> filterToLightsWithPower interactions
|
||||||
|
|
||||||
fakeHome.ForAllRemotelyControlledLights(fun (_, state) -> state = Off)
|
fakeHome.ForAllRemotelyControlledLights(fun (_, state) -> state = Off)
|
||||||
|
|> Prop.trivial (Seq.isEmpty lightsWithPower)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue