Introduce ArbitraryInteractions
This commit is contained in:
parent
d278b5d8ea
commit
8866053172
2 changed files with 33 additions and 33 deletions
|
|
@ -95,3 +95,7 @@ let ensureLastRemoteInteractionIs
|
||||||
interactions
|
interactions
|
||||||
else
|
else
|
||||||
interactions @ [ RemoteInteraction desiredLastRemoteInteraction ])
|
interactions @ [ RemoteInteraction desiredLastRemoteInteraction ])
|
||||||
|
|
||||||
|
type ArbitraryInteractions() =
|
||||||
|
static member Interactions() =
|
||||||
|
genInteractions |> ensureStartsWithTimeChanged |> Arb.fromGen
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,8 @@ type NightLightTests() =
|
||||||
|
|
||||||
fakeHome
|
fakeHome
|
||||||
|
|
||||||
[<Property>]
|
[<Property(Arbitrary = [| typeof<ArbitraryInteractions> |])>]
|
||||||
let ``All lights should either be off or have the right color`` () =
|
let ``All lights should either be off or have the right color`` (interactions: Interaction list) =
|
||||||
genInteractions |> ensureStartsWithTimeChanged |> Arb.fromGen |> Prop.forAll
|
|
||||||
<| fun interactions ->
|
|
||||||
let fakeHome = createFakeHomeWithNightLightAndInteract interactions
|
let fakeHome = createFakeHomeWithNightLightAndInteract interactions
|
||||||
let partOfDay = getPartOfDayAfterInteractions interactions
|
let partOfDay = getPartOfDayAfterInteractions interactions
|
||||||
|
|
||||||
|
|
@ -44,10 +42,8 @@ type NightLightTests() =
|
||||||
|> Prop.trivial (fakeHome.LightsThatAreOn.Length = 0)
|
|> Prop.trivial (fakeHome.LightsThatAreOn.Length = 0)
|
||||||
|> Prop.collect $"{fakeHome.LightsThatAreOn.Length} light(s) on"
|
|> Prop.collect $"{fakeHome.LightsThatAreOn.Length} light(s) on"
|
||||||
|
|
||||||
[<Property>]
|
[<Property(Arbitrary = [| typeof<ArbitraryInteractions> |])>]
|
||||||
let ``All non-remotely controlled lights that have power should be on`` () =
|
let ``All non-remotely controlled lights that have power should be on`` (interactions: Interaction list) =
|
||||||
genInteractions |> ensureStartsWithTimeChanged |> Arb.fromGen |> Prop.forAll
|
|
||||||
<| fun interactions ->
|
|
||||||
let fakeHome = createFakeHomeWithNightLightAndInteract interactions
|
let fakeHome = createFakeHomeWithNightLightAndInteract interactions
|
||||||
|
|
||||||
let nonRemotelyControlledLightsWithPower =
|
let nonRemotelyControlledLightsWithPower =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue