public void CheckIfFavoriteJobPostingAlreadyExistsTest()
        {
            var mockRepository = new Mock <IDeletableEntityRepository <FavoriteJobPosting> >();

            mockRepository.Setup(x => x.All()).Returns(this.GetFavoritesData());

            var service = new CandidateFavoriteJobPostingsService(mockRepository.Object);

            var favoritesCount = service.CheckIfFavoriteJobPostingAlreadyExists("1", "2");

            Assert.True(favoritesCount);
        }
        public void GetCategoriesTest()
        {
            var mockRepository = new Mock <IDeletableEntityRepository <FavoriteJobPosting> >();

            mockRepository.Setup(x => x.All()).Returns(this.GetFavoritesData());

            var service = new CandidateFavoriteJobPostingsService(mockRepository.Object);

            var categories = service.GetAllFavoriteJobPostingsIds("1");

            Assert.Single(categories);
        }
        public async Task DeleteJobPostingFromFavoritesTest()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString());

            var repository = new EfDeletableEntityRepository <FavoriteJobPosting>(new ApplicationDbContext(options.Options));

            foreach (var item in this.GetFavoritesData())
            {
                await repository.AddAsync(item);

                await repository.SaveChangesAsync();
            }

            var service = new CandidateFavoriteJobPostingsService(repository);

            await service.DeleteJobPostingFromFavorites("1", "2");

            var favoritesCount = repository.All().ToList().Count;

            Assert.Equal(2, favoritesCount);
        }