Assume that I have a condition in code, if strings.EqualFold(maxerror, "true") { //do something } else{ //do otherwise }
My config for “service.max.error” is set to “true”. So while testing, only the “if block” executes. How do I mock/overwrite the property value to test the “else” block.
Change your function/method to take a parameter from outside and pass the maxError as a parameter to this function. Try to avoid inject dependencies into your functions.