public void GetServiceById() { //Arrange var mockUnitOfWork = new Mock <IUnitOfWork>(); //Esperamos que se llame al metodo Get del ServiceRepository con un int mockUnitOfWork.Setup(un => un.ServiceRepository.GetByID(It.IsAny <int>())); ServiceValidator ServiceValidator = new ServiceValidator(mockUnitOfWork.Object); //Act Service returnedService = ServiceValidator.GetService("5"); //Assert //mockUnitOfWork.VerifyAll(); }