public void UserHasJoined_ShouldWorkCorrectly_WhenUserIsJoined() { var mockFactory = new Mock <IFactory>(); var mockTourneyRepository = new Mock <IRepository <Tourney> >(); var mockUserRepository = new Mock <IRepository <User> >(); var mockPlayerRepository = new Mock <IRepository <Player> >(); var mockUnitOfWork = new Mock <IUnitOfWork>(); var service = new TourneyService( mockFactory.Object, mockTourneyRepository.Object, mockUserRepository.Object, mockPlayerRepository.Object, mockUnitOfWork.Object ); var mockTourney = new Mock <Tourney>(); //TODO fix the search logic to be testable mockTourneyRepository.Setup(x => x.GetById(It.IsAny <int>())).Returns(mockTourney.Object); service.EditTourney(mockTourney.Object); mockUnitOfWork.Verify(x => x.Commit(), Times.Once); }
public void EditProduct_ShouldCallUnitOfWork() { var mockFactory = new Mock <IFactory>(); var mockTourneyRepository = new Mock <IRepository <Tourney> >(); var mockUserRepository = new Mock <IRepository <User> >(); var mockPlayerRepository = new Mock <IRepository <Player> >(); var mockUnitOfWork = new Mock <IUnitOfWork>(); var service = new TourneyService( mockFactory.Object, mockTourneyRepository.Object, mockUserRepository.Object, mockPlayerRepository.Object, mockUnitOfWork.Object ); var mockTourney = new Mock <Tourney>(); service.EditTourney(mockTourney.Object); mockUnitOfWork.Verify(x => x.Commit(), Times.Once); }