Skip to content

Commit

Permalink
Tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
bartelink committed Jun 12, 2020
1 parent ed734b0 commit d62fa9f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions equinox-fc/Domain.Tests/LocationTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@ let run (service : Fc.Domain.Location.Service) (IdsAtLeastOne locations, deltas
let! balances = seq { for loc in locations -> async { let! bal = service.Execute(loc,(fun (Epoch.Fold.Balance bal) -> bal, [])) in return loc,bal } } |> Async.Parallel
test <@ expectedBalances = Set.ofSeq balances @> }

let [<Property>] ``MemoryStore properties`` maxEvents args =
let [<Property>] ``MemoryStore properties`` epochLen args =
let store = Equinox.MemoryStore.VolatileStore()

let maxEvents = max 1 maxEvents
let service = Location.MemoryStore.create (Epoch.zeroBalance, Epoch.toBalanceCarriedForward 5, Epoch.shouldClose maxEvents) store
let epochLen, idsWindow = max 1 epochLen, 5
let zero, cf, sc = Epoch.zeroBalance, Epoch.toBalanceCarriedForward idsWindow, Epoch.shouldClose epochLen

let service = Location.MemoryStore.create (zero, cf, sc) store
run service args

type EventStore(testOutput) =
Expand All @@ -64,7 +66,9 @@ type EventStore(testOutput) =

let context, cache = EventStore.connect ()

let [<Property(MaxTest=5, MaxFail=1)>] properties maxEvents args =
let maxEvents = max 1 maxEvents
let service = Fc.Domain.Location.EventStore.create (Epoch.zeroBalance, Epoch.toBalanceCarriedForward 5, Epoch.shouldClose maxEvents) (context, cache, 50)
let [<Property(MaxTest=5, MaxFail=1)>] properties epochLen args =
let epochLen, idsWindow = max 1 epochLen, 5
let zero, cf, sc = Epoch.zeroBalance, Epoch.toBalanceCarriedForward idsWindow, Epoch.shouldClose epochLen

let service = Fc.Domain.Location.EventStore.create (zero, cf, sc) (context, cache, 50)
run service args
2 changes: 1 addition & 1 deletion equinox-fc/Domain/StockProcessManager.fs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module EventStore =
let create inventoryId (epochLen, idsWindow, maxAttempts) (context, cache) =
let transactions, locations, inventory =
let transactions = StockTransaction.EventStore.create (context, cache)
let zero, cf, sc = (Location.Epoch.zeroBalance, Location.Epoch.toBalanceCarriedForward idsWindow, Location.Epoch.shouldClose epochLen)
let zero, cf, sc = Location.Epoch.zeroBalance, Location.Epoch.toBalanceCarriedForward idsWindow, Location.Epoch.shouldClose epochLen
let locations = Location.EventStore.create (zero, cf, sc) (context, cache, maxAttempts)
let inventory = Inventory.EventStore.create inventoryId (context, cache)
transactions, locations, inventory
Expand Down

0 comments on commit d62fa9f

Please sign in to comment.