๐Ÿ“ฆ sleepyfran / duets

๐Ÿ“„ State.Merch.Tests.fs ยท 28 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28module Duets.Simulation.Tests.State.Merch

open FsUnit
open NUnit.Framework
open Test.Common

open Duets.Entities
open Duets.Simulation

let private dummyMerch =
    { Brand = "DuetsMerch"
      Name = "T-shirt"
      Properties = [ Wearable TShirt ] }

[<Test>]
let ``MerchSold updates the band inventory removing the sold items`` () =
    let state =
        ItemAddedToBandInventory(dummyBand, dummyMerch, 200<quantity>)
        |> State.Root.applyEffect dummyState

    let state =
        MerchSold(dummyBand, [ dummyMerch, 91<quantity> ], 200m<dd>)
        |> State.Root.applyEffect state

    Queries.Inventory.band dummyBand.Id state
    |> Map.find dummyMerch
    |> should equal 109<quantity>