How to use mock which is not passed to real object
问题 I have service CarTankService as shown below. It has Add method which i want to test. To be more detailed i would like to check whether AddTank (inside Add) will be reached. public class CarTankService : ICarTankService { private readonly ITankQuery _tankQuery; private readonly CarClient _carClient; public CarTankService(ITankQuery tankQuery) { _tankQuery = tankQuery; _carClient = new CarClient(); } public ObservableCollection<CarTank> GetTanks() => _carClient.Tanks; public void