go-pattern-examples/behavior/15_strategy/strategy_test.go

26 lines
411 B
Go
Raw Normal View History

2020-04-21 17:50:21 +03:00
package strategy
2020-04-28 09:43:37 +03:00
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)
2020-04-21 17:50:21 +03:00
2020-04-28 09:43:37 +03:00
ctx = &StoreContext{
Kind: "HK",
CardID: "987345678456",
Money: 8723,
}
bank.AccountUserMoney(ctx)
2020-04-21 17:50:21 +03:00
}