mirror of
https://github.com/crazybber/go-pattern-examples.git
synced 2024-12-01 07:46:01 +03:00
23 lines
405 B
Go
23 lines
405 B
Go
package adapter
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestPowerSocketAdapter(t *testing.T) {
|
|
|
|
plug := &TwoPinPlugin{}
|
|
|
|
threePinSocket := ThreePinPowerSocket{}
|
|
|
|
//三孔插头是不能为两针插头充电的,可以试试看
|
|
threePinSocket.ThreePinCharging(plug)
|
|
|
|
//只好加一个电源适配器
|
|
powersocket := NewPowerAdapter(&threePinSocket)
|
|
|
|
//再试试能不能充电
|
|
powersocket.PlugCharging(plug)
|
|
|
|
}
|