mirror of
https://github.com/crazybber/go-pattern-examples.git
synced 2024-11-28 06:36:02 +03:00
26 lines
411 B
Go
26 lines
411 B
Go
package strategy
|
|
|
|
import "testing"
|
|
|
|
func TestStoreMoney(t *testing.T) {
|
|
|
|
bank := Bank{&MainLandCitizen{"Miss White"}}
|
|
ctx := &StoreContext{
|
|
Kind: "RMB",
|
|
CardID: "12345678921",
|
|
Money: 10000,
|
|
}
|
|
bank.AccountUserMoney(ctx)
|
|
|
|
hkUser := &HongKongCitizen{"Miss Black"}
|
|
|
|
bank.Recept(hkUser)
|
|
|
|
ctx = &StoreContext{
|
|
Kind: "HK",
|
|
CardID: "987345678456",
|
|
Money: 8723,
|
|
}
|
|
bank.AccountUserMoney(ctx)
|
|
}
|