I'm trying to call the real public virtual method on the repository here, it's skipping right through. What am I missing? I have also used _mocker.GetMock -> setup method .Callbase()
[Test]
public void RunJob()
{
//Mock the service.
var mockService = _mocker.GetMock<IService>();
var mockRepo = new Mock<Repository>() {CallBase = true};
//Setup service mock to pretend to call out.
mockService.Setup(service => service.Trigger();
//Create job object.
var job = _mocker.Resolve<Job>();
//Execute job.
job.Process();
//Verify service mock "called out".
mockAlertService.Verify(service => service.TriggerAlert()), Times.AtLeastOnce);
}
Aucun commentaire:
Enregistrer un commentaire