public void UpdateSholdCallUnitOfWorkComitOnce()
        {
            var mockeRepository  = new Mock <IGenericRepository <User> >();
            var mockedUnitOfWork = new Mock <IUnitOfWork>();
            var genericService   = new SportSqaureGenericServiceMock(mockeRepository.Object, mockedUnitOfWork.Object);

            mockedUnitOfWork.Setup(x => x.Commit()).Verifiable();
            genericService.Update(new User());
            mockedUnitOfWork.Verify(x => x.Commit(), Times.Once);
        }
        public void GetByIdShouldCallRepositoryGetByIdOnceWithSameId(int fakeId)
        {
            var mockeRepository  = new Mock <IGenericRepository <User> >();
            var mockedUnitOfWork = new Mock <IUnitOfWork>();
            var genericService   = new SportSqaureGenericServiceMock(mockeRepository.Object, mockedUnitOfWork.Object);

            mockeRepository.Setup(x => x.GetById(fakeId)).Verifiable();
            genericService.GetById(fakeId);
            mockeRepository.Verify(x => x.GetById(It.Is <int>(y => y == fakeId)), Times.Once);
        }
        public void GetAllShouldCallRepositoryGetAllOnce()
        {
            var mockeRepository  = new Mock <IGenericRepository <User> >();
            var mockedUnitOfWork = new Mock <IUnitOfWork>();
            var genericService   = new SportSqaureGenericServiceMock(mockeRepository.Object, mockedUnitOfWork.Object);

            mockeRepository.Setup(x => x.GetAll()).Verifiable();
            genericService.GetAll();
            mockeRepository.Verify(x => x.GetAll(), Times.Once);
        }
        public void UpdateSholdCallRepositoryUpdateWithSameUser()
        {
            var mockeRepository  = new Mock <IGenericRepository <User> >();
            var mockedUnitOfWork = new Mock <IUnitOfWork>();
            var fakeUser         = new User();
            var genericService   = new SportSqaureGenericServiceMock(mockeRepository.Object, mockedUnitOfWork.Object);

            mockeRepository.Setup(x => x.Update(fakeUser)).Verifiable();
            genericService.Update(fakeUser);
            mockeRepository.Verify(x => x.Update(It.Is <User>(y => y == fakeUser)), Times.Once);
        }
        public void HideSholdCallRepositoryHideOnce()
        {
            var mockeRepository  = new Mock <IGenericRepository <User> >();
            var mockedUnitOfWork = new Mock <IUnitOfWork>();
            var fakeUser         = new User();
            var genericService   = new SportSqaureGenericServiceMock(mockeRepository.Object, mockedUnitOfWork.Object);

            mockeRepository.Setup(x => x.Hide(fakeUser)).Verifiable();
            genericService.Hide(fakeUser);
            mockeRepository.Verify(x => x.Hide(fakeUser), Times.Once);
        }