public void DoesntUpdateNonExistingService() { //Arrange var mockUnitOfWork = new Mock <IUnitOfWork>(); mockUnitOfWork .Setup(un => un.ServiceRepository.GetByID(It.IsAny <int>())).Returns(() => null); mockUnitOfWork.Setup(un => un.ServiceRepository.Update(It.IsAny <Service>())); //mockUnitOfWork.Setup(un => un.Save()); IServiceValidator ServiceValidator = new ServiceValidator(mockUnitOfWork.Object); //act ServiceValidator.PutService("0", new Service() { }); //Assert //Retorna exception }