public void GetPupilProfileById_Test_Is_Generete_Exeption_If_Id_less_zero()
        {
            //Arrange
            var logger = new Mock<ILogger>();
            var iUnitOfWork = new Mock<IUnitOfWork>();
            var iPupilRepository = new Mock<IRepository<Pupil>>();
            var iAccountService = new Mock<IAccountService>();
            var iGroupService = new Mock<IGroupService>();

            iUnitOfWork.Setup(st => st.PupilRepository).Returns(iPupilRepository.Object);
            var pupilService = new PupilService(logger.Object, iUnitOfWork.Object, iAccountService.Object, iGroupService.Object);
            int anyIdLessZero = -2;
            //Act
            var teacher = pupilService.GetProfileById(anyIdLessZero);
            //Assert
            iPupilRepository.Verify(inv => inv.GetById(anyIdLessZero), Times.Once);
        }
        public void AddPupilUnitTest()
        {
            //Arrange
            var logger = new Mock<ILogger>();
            var iUnitOfWork = new Mock<IUnitOfWork>();
            var iPupilRepository = new Mock<IRepository<Pupil>>();
            var iAccountService = new Mock<IAccountService>();
            var iGroupService = new Mock<IGroupService>();

            iUnitOfWork.Setup(st => st.PupilRepository).Returns(iPupilRepository.Object);
            var pupilService = new PupilService(logger.Object, iUnitOfWork.Object, iAccountService.Object, iGroupService.Object);
            var viewPupil = AutoMapper.Mapper.Map<Pupil, sModels.ViewPupil>(this.pupil);
            //Act
            pupilService.AddPupil(viewPupil);
            //Assert
            iPupilRepository.Verify(inv => inv.Add(It.IsAny<Pupil>()), Times.Once);
        }
        public void GetPupilProfileById_Test_Is_Invoke_Repo_GetById()
        {
            //Arrange
            var logger = new Mock<ILogger>();
            var iUnitOfWork = new Mock<IUnitOfWork>();
            var iPupilRepository = new Mock<IRepository<Pupil>>();
            var iAccountService = new Mock<IAccountService>();
            var iGroupService = new Mock<IGroupService>();

            iUnitOfWork.Setup(st => st.PupilRepository).Returns(iPupilRepository.Object);
            iPupilRepository.Setup(inv => inv.GetById(It.Is<int>(i => i > 0))).Returns(this.pupil);
            var pupilService = new PupilService(logger.Object, iUnitOfWork.Object, iAccountService.Object, iGroupService.Object);

            int anyIdMoreZero = 3;
            //Act
            pupilService.GetProfileById(anyIdMoreZero);
            //Assert
            iPupilRepository.Verify(inv => inv.GetById(anyIdMoreZero), Times.Once);
        }
        public void UpdatePupilProfileUnitTest()
        {
            //Arrange
            var logger = new Mock<ILogger>();
            var iUnitOfWork = new Mock<IUnitOfWork>();
            var iPupilRepository = new Mock<IRepository<Pupil>>();
            var iAccountService = new Mock<IAccountService>();
            var iGroupService = new Mock<IGroupService>();

            iUnitOfWork.Setup(st => st.PupilRepository).Returns(iPupilRepository.Object);
            var pupilService = new PupilService(logger.Object, iUnitOfWork.Object, iAccountService.Object, iGroupService.Object);
            //Act
            pupilService.UpdateProfile(this.viewPupil);
            //Assert
            iPupilRepository.Verify(inv => inv.Update(It.IsAny<Pupil>()), Times.Once);
        }
        public void RemovePupilUnitTest()
        {
            //Arrange
            var logger = new Mock<ILogger>();
            var iRepository = new Mock<IRepository<Pupil>>();
            var iUnitOfWork = new Mock<IUnitOfWork>();
            var iAccountService = new Mock<IAccountService>();
            var iGroupService = new Mock<IGroupService>();

            var pupilService = new PupilService(logger.Object, iUnitOfWork.Object, iAccountService.Object, iGroupService.Object);
            iUnitOfWork.SetupGet(u => u.PupilRepository).Returns(iRepository.Object);
            //Act
            pupilService.RemovePupil(this.pupil.Id);
            //Assert
            iRepository.Verify(inv => inv.Delete(It.IsAny<Pupil>()), Times.Once);
        }
        public void GetPupil_Test_If_Get_All_Pupil_And_Invoke_GetAll_repository_Method()
        {
            //Arange
            var logger = new Mock<ILogger>();
            var iUnitOfWork = new Mock<IUnitOfWork>();
            var iPupilRepository = new Mock<IRepository<Pupil>>();
            var iAccountService = new Mock<IAccountService>();
            var iGroupService = new Mock<IGroupService>();

            iUnitOfWork.Setup(st => st.PupilRepository).Returns(iPupilRepository.Object);
            var pupilService = new PupilService(logger.Object, iUnitOfWork.Object, iAccountService.Object, iGroupService.Object);
            //Act
            pupilService.GetAllPupils();
            //Assert
            iPupilRepository.Verify(inv => inv.GetAll(), Times.Once);
        }