go-pattern-examples/creation/08_abstract_factory/abstractfactory_test.go

31 lines
670 B
Go
Raw Permalink Normal View History

2020-04-21 17:50:21 +03:00
package abstractfactory
import "testing"
func TestRobotBatteryFactory(t *testing.T) {
factory := &HomeRobotFactory{}
robot := factory.CreateRobot()
robot.DoWork()
battery := factory.CreateBattery()
battery.Charge(robot)
}
func TestSQLFactory(t *testing.T) {
2020-04-21 17:50:21 +03:00
factory := &SQLFactory{}
orderWorker := factory.CreateOrderWorker()
orderWorker.SaveOrder()
detailWorker := factory.CreateOrderDetailWorker()
detailWorker.SaveOrderDetail()
2020-04-21 17:50:21 +03:00
}
func TestNoSqlFactory(t *testing.T) {
factory := &NoSQLFactory{}
orderWorker := factory.CreateOrderWorker()
orderWorker.SaveOrder()
detailWorker := factory.CreateOrderDetailWorker()
detailWorker.SaveOrderDetail()
2020-04-21 17:50:21 +03:00
}