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
|
||||
else
|
||||
interactions @ [ RemoteInteraction desiredLastRemoteInteraction ])
|
||||
|
||||
type ArbitraryInteractions() =
|
||||
static member Interactions() =
|
||||
genInteractions |> ensureStartsWithTimeChanged |> Arb.fromGen
|
||||
|
|
|
|||
|
|
@ -25,10 +25,8 @@ type NightLightTests() =
|
|||
|
||||
fakeHome
|
||||
|
||||
[<Property>]
|
||||
let ``All lights should either be off or have the right color`` () =
|
||||
genInteractions |> ensureStartsWithTimeChanged |> Arb.fromGen |> Prop.forAll
|
||||
<| fun interactions ->
|
||||
[<Property(Arbitrary = [| typeof<ArbitraryInteractions> |])>]
|
||||
let ``All lights should either be off or have the right color`` (interactions: Interaction list) =
|
||||
let fakeHome = createFakeHomeWithNightLightAndInteract interactions
|
||||
let partOfDay = getPartOfDayAfterInteractions interactions
|
||||
|
||||
|
|
@ -44,10 +42,8 @@ type NightLightTests() =
|
|||
|> Prop.trivial (fakeHome.LightsThatAreOn.Length = 0)
|
||||
|> Prop.collect $"{fakeHome.LightsThatAreOn.Length} light(s) on"
|
||||
|
||||
[<Property>]
|
||||
let ``All non-remotely controlled lights that have power should be on`` () =
|
||||
genInteractions |> ensureStartsWithTimeChanged |> Arb.fromGen |> Prop.forAll
|
||||
<| fun interactions ->
|
||||
[<Property(Arbitrary = [| typeof<ArbitraryInteractions> |])>]
|
||||
let ``All non-remotely controlled lights that have power should be on`` (interactions: Interaction list) =
|
||||
let fakeHome = createFakeHomeWithNightLightAndInteract interactions
|
||||
|
||||
let nonRemotelyControlledLightsWithPower =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue