abstractfactory_test.go
最后更新于:2022-04-02 04:48:16
~~~
package abstractfactory
import (
"fmt"
"testing"
)
func TestAbstractFactory(t *testing.T) {
uData := User{1, "u"}
dData := Department{1, "d"}
data := DataAccess{}
iU := data.createUser("access")
iU.insert(&uData)
gU := iU.getUser(1)
fmt.Println(gU)
fmt.Println("================")
iD := data.createDepartment("sqlserver")
iD.insert(&dData)
gD := iD.getDepartment(1)
fmt.Println(gD)
if iS := data.createDepartment("a"); iS != nil {
t.Error()
}
}
~~~
';