public void ReadAllDronesEnsureRepositoryIsCalled() { var droneRepo = new Mock <IDroneRepository>(); IDroneService service = new DroneService(droneRepo.Object); var isCalled = false; var filter = new Filter(); droneRepo.Setup(x => x.GetAllDrones(filter)).Callback(() => isCalled = true) .Returns(new FilteredList <Drone>()); service.GetAllDrones(filter); Assert.True(isCalled); }