public void UpdateVerifiedDate_AnySpecializationId_ExpriredToday()
        {
            var settingsMock = new Mock<ISettings>();
            var repositoryMock = new Mock<IRepository>();
            var uowMock = new Mock<IUnitOfWork>();
            var serviceLocatorMock = new Mock<IServiceLocator>();
            serviceLocatorMock.Setup(x => x.GetInstance<IRepository>())
                .Returns(repositoryMock.Object);
            serviceLocatorMock.Setup(x => x.GetInstance<IUnitOfWork>())
                .Returns(uowMock.Object);

            ServiceLocator.SetLocatorProvider(() => serviceLocatorMock.Object);
            repositoryMock.Setup(r => r.CreateUnitOfWork()).Returns(uowMock.Object);

            // Arrange
            Guid id = Guid.NewGuid();
            DateTime expiredDate = DateTime.Now;

            Specialization specialization = new Specialization
            {
                Id = id
            };
            Specialization[] specializations = new Specialization[] { specialization };

            repositoryMock.Setup(r => r.Query<Specialization>()).Returns(specializations.AsQueryable());

            // Act
            ManagementService managementService = new ManagementService(uowMock.Object, repositoryMock.Object, settingsMock.Object);
            var currentResult = managementService
                .UpdateVerifiedDate(id.ToString(), expiredDate);

            // Assert
            repositoryMock.Verify(repo => repo
                .Update<Specialization>(It.Is<Specialization>(
                    s => s.Id == id && s.ExpiredDate == expiredDate)));
            uowMock.Verify(uow => uow.Save());
        }
        public void GetSpecializationById_AnyResult_CallsQueryMethodOfRepository()
        {
            var settingsMock = new Mock<ISettings>();
            var componentsMock = new Mock<IComponents>();
            var repositoryMock = new Mock<IRepository>();
            var uowMock = new Mock<IUnitOfWork>();
            var serviceLocatorMock = new Mock<IServiceLocator>();
            serviceLocatorMock.Setup(x => x.GetInstance<IRepository>())
                .Returns(repositoryMock.Object);
            serviceLocatorMock.Setup(x => x.GetInstance<IUnitOfWork>())
                .Returns(uowMock.Object);
            ServiceLocator.SetLocatorProvider(() => serviceLocatorMock.Object);

            // Arrange
            Guid id = Guid.NewGuid();
            Specialization specialization = new Specialization()
            {
                Id = id
            };
            Specialization[] specializations = new Specialization[] {specialization };
            repositoryMock.Setup(r => r.Query<Specialization>()).Returns(specializations.AsQueryable());
            repositoryMock.Setup(r => r.CreateUnitOfWork()).Returns(uowMock.Object);
            // Act
            var userService = new UserService(uowMock.Object,repositoryMock.Object, settingsMock.Object, componentsMock.Object);
            SpecializationDto actuaSpecializationDto = userService.GetSpecializationById(id);

            // Assert
            repositoryMock.Verify(repo => repo.Query<Specialization>());
            Assert.AreEqual(actuaSpecializationDto.Id, specialization.Id);
        }