2020-04-21 17:50:21 +03:00
|
|
|
package abstractfactory
|
|
|
|
|
2020-04-27 06:41:24 +03:00
|
|
|
import "testing"
|
|
|
|
|
2020-04-27 06:55:19 +03:00
|
|
|
func TestRobotBatteryFactory(t *testing.T) {
|
|
|
|
|
|
|
|
factory := &HomeRobotFactory{}
|
|
|
|
robot := factory.CreateRobot()
|
|
|
|
robot.DoWork()
|
|
|
|
battery := factory.CreateBattery()
|
|
|
|
battery.Charge(robot)
|
|
|
|
}
|
|
|
|
|
2020-04-27 06:41:24 +03:00
|
|
|
func TestSQLFactory(t *testing.T) {
|
2020-04-21 17:50:21 +03:00
|
|
|
|
2020-04-27 06:41:24 +03:00
|
|
|
factory := &SQLFactory{}
|
|
|
|
orderWorker := factory.CreateOrderWorker()
|
|
|
|
orderWorker.SaveOrder()
|
|
|
|
detailWorker := factory.CreateOrderDetailWorker()
|
|
|
|
detailWorker.SaveOrderDetail()
|
2020-04-21 17:50:21 +03:00
|
|
|
}
|
|
|
|
|
2020-04-27 06:41:24 +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
|
|
|
}
|