2014-07-18 04:07:34 +08:00
|
|
|
package gobot
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
func TestAdaptor(t *testing.T) {
|
|
|
|
a := NewAdaptor("", "testBot", "/dev/null")
|
|
|
|
Refute(t, a.Name(), "")
|
|
|
|
a.SetPort("/dev/null1")
|
|
|
|
Assert(t, a.Port(), "/dev/null1")
|
|
|
|
a.SetName("myAdaptor")
|
|
|
|
Assert(t, a.Name(), "myAdaptor")
|
2014-08-21 02:41:16 +08:00
|
|
|
|
2014-07-18 04:07:34 +08:00
|
|
|
a.SetConnected(true)
|
|
|
|
Assert(t, a.Connected(), true)
|
2014-08-21 02:41:16 +08:00
|
|
|
|
2014-08-22 05:09:41 +08:00
|
|
|
a.SetConnected(false)
|
2014-08-21 02:41:16 +08:00
|
|
|
Assert(t, a.Connected(), false)
|
2014-07-18 04:07:34 +08:00
|
|
|
}
|