0
안녕 내가 오류를 얻고있다 불렀다 내가MOQ는 방법이
[SetUp]
public void Setup()
{
visitService = new Mock<IVisitService>();
visitRepository = new Mock<IVisitRepository>();
visitUIService = new VisitUIService(visitRepository.Object, visitService.Object);
}
[Test]
public void VisitUIService_CanSoftDelete()
{
Mock<IVisitEntity> mockVisitEntity = new Mock<IVisitEntity>();
visitService = new Mock<IVisitService>();
visitRepository.Setup(x => x.GetVisitsByDocumentLineItems(It.IsAny<IEnumerable<int>>())).Returns(new List<IVisitEntity>() { mockVisitEntity.Object});
visitUIService.DeleteVisits(new VisitDeletionModel());
visitService.Verify(x => x.SoftDeleteVisit(It.IsAny<IVisitEntity>()),Times.AtLeastOnce());
}
호출이 모의 수행되지 않은 이유를 이해하지 않는 경우 확인하지 확인합니다 : X => x.SoftDeleteVisit (IsAny())
visService.Setup (x => x.SoftDeleteVisit (mockVisitEntity.Object))을 추가하여 수정할 수 없습니다. Verifiable(); 및 매개 변수의 몇 가지 다른 유사하지만 행운
내가 문제가 이미 intial 조롱 인터페이스와 나중에하고있는 설정으로 초기화되어 소비 객체 visitUIService입니다 유용하지 않다 생각하면