mirror of
https://github.com/crazybber/go-pattern-examples.git
synced 2024-11-22 11:56:03 +03:00
34 lines
668 B
Go
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)
|
|
}
|
|
}
|