You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
408 B
21 lines
408 B
package strategy
|
|
|
|
import (
|
|
"designpatterns/factory"
|
|
"testing"
|
|
)
|
|
|
|
func TestCashContext_GetCash(t *testing.T) {
|
|
var cash CashContext
|
|
a := 2
|
|
switch a {
|
|
case 1:
|
|
cash = CashContext{cash: &factory.CashNormal{}}
|
|
case 2:
|
|
cash = CashContext{&factory.CashRebate{MoneyRebate: 0.99}}
|
|
case 3:
|
|
cash = CashContext{&factory.CashReturn{MoneyReturn: 100, MoneyCondition: 600}}
|
|
}
|
|
t.Log(cash.GetResponse(600))
|
|
}
|