【发布时间】:2020-08-05 03:49:45
【问题描述】:
我使用testify (v1.6.1) 并且需要测试 接口的方法是否以正确的顺序调用。我查了documentation并试图在互联网上找到任何信息,但没有找到任何关于模拟订单检查的信息。
例子:
type InterfaceA interface {
Execute()
}
type InterfaceB interface {
Execute()
}
type Composition struct {
a InterfaceA
b InterfaceB
}
func (c * Composition) Apply() error {
//How to check that "a" execute before "b"?
c.a.Execute()
c.b.Execute()
return nil
}
【问题讨论】: