public void UpdateTour_ValidTour_ReturnTrue() { // Arrange var mock = new Mock <IUnitOfWork>(); mock.Setup(unitOfWork => unitOfWork.TourRepository.Update(It.IsAny <TourEntity>())).Verifiable(); mock.Setup(unitOfWork => unitOfWork.Commit()).Verifiable(); var tourService = new TourService(mock.Object); TourDto tour = new TourDto() { Name = "TourId", Price = 5 }; int tourId = 1; // Act var result = tourService.UpdateTourById(tourId, tour); // Assert mock.Verify(moq => moq.Commit(), Times.Once); Assert.True(result); }