go-pattern-examples/structure/07_proxy/proxy_test.go

34 lines
668 B
Go
Raw Permalink Normal View History

2020-04-21 17:50:21 +03:00
package proxy
2020-04-30 12:47:41 +03:00
import (
"testing"
)
2020-04-21 17:50:21 +03:00
func TestProxy(t *testing.T) {
2020-04-30 12:47:41 +03:00
proxyCompany := RegistryProxyCompany{p: Pioneer{10000, UK}}
2020-04-21 17:50:21 +03:00
2020-04-30 12:47:41 +03:00
//想注册一个叫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)
2020-04-21 17:50:21 +03:00
}
}