go-pattern-examples/structure/07_proxy/proxy_test.go
2020-05-02 17:40:51 +08:00

34 lines
668 B
Go

package proxy
import (
"testing"
)
func TestProxy(t *testing.T) {
proxyCompany := RegistryProxyCompany{p: Pioneer{10000, UK}}
//想注册一个叫fire company 的公司
name, no, err := proxyCompany.RegisterCompany("fire company")
if err != nil {
t.Log("something wrong:", err.Error())
} else {
t.Log("got company, name:", name, "company no:", no)
}
proxyCompany = RegistryProxyCompany{p: Pioneer{109999, CN}}
//想注册一个叫fire company 的公司
name, no, err = proxyCompany.RegisterCompany("water company")
if err != nil {
t.Log("something wrong:", err.Error())
} else {
t.Log("got company, name:", name, "company no:", no)
}
}