2020-04-21 17:50:21 +03:00
|
|
|
|
package bridge
|
|
|
|
|
|
2020-04-28 11:37:17 +03:00
|
|
|
|
import "testing"
|
2020-04-21 17:50:21 +03:00
|
|
|
|
|
2020-04-28 11:37:17 +03:00
|
|
|
|
func TestSendMessage(t *testing.T) {
|
2020-04-21 17:50:21 +03:00
|
|
|
|
|
2020-04-28 11:37:17 +03:00
|
|
|
|
//注意看这里,接口的实例关系在初始化时候是固定的
|
|
|
|
|
ws := &WSMessage{&EmergencyWSMessage{}, 100}
|
|
|
|
|
|
|
|
|
|
//注意看这里,接口的实例关系在初始化时候是固定的
|
|
|
|
|
email := &EmailMessage{&EmergencyEmailMessage{}, 10}
|
|
|
|
|
|
|
|
|
|
ws.NoticeUser("Miss White ,Let's Drink")
|
|
|
|
|
email.NoticeUser("Miss White,Fire!,Fire!")
|
2020-04-21 17:50:21 +03:00
|
|
|
|
|
2020-04-28 11:37:17 +03:00
|
|
|
|
ews := &EmergencyWSMessage{}
|
|
|
|
|
eem := &EmergencyEmailMessage{}
|
|
|
|
|
list := []IMessage{
|
|
|
|
|
&WSMessage{ews, 50},
|
|
|
|
|
&WSMessage{ews, 100},
|
|
|
|
|
&EmailMessage{eem, 10},
|
|
|
|
|
&EmailMessage{eem, 20},
|
|
|
|
|
}
|
|
|
|
|
for _, v := range list {
|
|
|
|
|
v.NoticeUser("Let’s go for fun")
|
|
|
|
|
}
|
2020-04-21 17:50:21 +03:00
|
|
|
|
}
|