I'm trying to write some Unit Tests to an existing code, written in GO, but i really don't know what is the better approach to choose. My method call other methods that call some other methods, and use channels.
func variation(context context.Execution, variationTransfer VariationTransfer){
numItems = getNumItems( context, variationTransfer )
validate(variationTransfer)
mychannel := make(chan interface{}, len(numItems))
mychannel <- message
}
func validate(variationTransfer VariationTransfer ){
... validation code here
callAnotherMethod()
}
What is the best practice? use Mock or interfaces??
Aucun commentaire:
Enregistrer un commentaire