public void GetFavouriteListBySpecialistId_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();
            User user = new User()
            {
                Id = id,

            };

            Favourite favourite1 = new Favourite()
            {
                Specialist = user
            };

            Favourite favourite2 = new Favourite()
            {
                Specialist = user
            };
            Favourite[] favourites = new Favourite[] { favourite1, favourite2 };
            repositoryMock.Setup(r => r.Query<Favourite>()).Returns(favourites.AsQueryable());
            repositoryMock.Setup(r => r.CreateUnitOfWork()).Returns(uowMock.Object);
            // Act
            var userService = new UserService(uowMock.Object,repositoryMock.Object, settingsMock.Object, componentsMock.Object);
            List<FavouriteDto> actuaFavourites = userService.GetFavouriteListBySpecialistId(id);

            // Assert
            repositoryMock.Verify(repo => repo.Query<Favourite>());
            Assert.AreEqual(actuaFavourites.Count(), favourites.Count());
        }
        public void DeleteFavourite_Any_CallsDeleteMethodOfRepository()
        {
            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 specialistId = Guid.NewGuid();
            Guid customerId = Guid.NewGuid();
            Guid id = Guid.NewGuid();
            Favourite favourite= new Favourite
            {
                Id =id,
                Customer = new User()
                {
                    Id=customerId
                },
                Specialist = new User()
                {
                    Id=specialistId
                }
            };
            Favourite[] favourites = new Favourite[] { favourite };
            repositoryMock.Setup(r => r.Query<Favourite>()).Returns(favourites.AsQueryable()); ;
            repositoryMock.Setup(r => r.FindById<Favourite>(id)).Returns(favourite);
            repositoryMock.Setup(r => r.Delete<Favourite>(favourite));
            repositoryMock.Setup(r => r.CreateUnitOfWork()).Returns(uowMock.Object);
            // Act
            var userService = new UserService(uowMock.Object,repositoryMock.Object, settingsMock.Object, componentsMock.Object);
            userService.DeleteFavourite(specialistId,customerId);

            // Assert
            repositoryMock.Verify(repo => repo.Delete<Favourite>(favourite));
            uowMock.Verify(uow => uow.Save());
        }