go-pattern-examples/behavior/11_command/command_test.go

21 lines
415 B
Go
Raw Normal View History

2020-04-21 17:50:21 +03:00
package command
func ExampleCommand() {
mb := &MotherBoard{}
startCommand := NewStartCommand(mb)
rebootCommand := NewRebootCommand(mb)
box1 := NewBox(startCommand, rebootCommand)
box1.PressButtion1()
box1.PressButtion2()
box2 := NewBox(rebootCommand, startCommand)
box2.PressButtion1()
box2.PressButtion2()
// Output:
// system starting
// system rebooting
// system rebooting
// system starting
}