public void GetCountByAuthorIdDeletedFakeIdTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var service = this.GetArticlesService(repository); var result = service.GetCountByAuthorIdDeleted("FAKE"); Assert.Equal(0, result); }
public void GetArticleById() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var service = this.GetArticlesService(repository); var result = service.GetArticleById <ArticleDumyModel>(article.Id).GetAwaiter().GetResult(); Assert.Equal(article.Title, result.Title); }
public void GetCountByAuthorRealIdTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var service = this.GetArticlesService(repository); var result = service.GetCountByAuthorId("ads"); Assert.Equal(1, result); }
public void GetCountOfLocalArticlesNoResultTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var service = this.GetArticlesService(repository); var result = service.GetCountOfLocalArticles(); Assert.Equal(0, result); }
public void ArticleExistTrueTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var service = this.GetArticlesService(repository); var result = service.ArticleExist(article.Id); Assert.True(result); }
public void LastesArticleCreationDateTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var secondArticle = this.CreateArticle(repository, SeedArticle.CreateSecondArticle()); var service = this.GetArticlesService(repository); var result = service.LastesArticleCreationDate(); Assert.Equal(secondArticle.CreatedOn, result); }
public void GetCountByRegionNoMatchTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var secondArticle = this.CreateArticle(repository, SeedArticle.CreateSecondArticle()); var service = this.GetArticlesService(repository); var result = service.GetCountByRegion(Region.Sofia); Assert.Equal(0, result); }
public void GetCountOfLocalArticlesOneMatchTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var articleWithRegion = this.CreateArticle(repository, SeedArticle.CreateSecondArticle()); var service = this.GetArticlesService(repository); var result = service.GetCountOfLocalArticles(); Assert.Equal(1, result); }
public void GetLatesWithVideosOneMatchTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var secondArticle = this.CreateArticle(repository, SeedArticle.CreateSecondArticle()); var service = this.GetArticlesService(repository); var result = service.GetLatesWithVideos <ArticleDumyModel>(); Assert.Single(result); }
public void GetLatesByCreatedTwoMatchesOnTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var secondArticle = this.CreateArticle(repository, SeedArticle.CreateSecondArticle()); var service = this.GetArticlesService(repository); var result = service.GetLatesByCreatedOn <ArticleDumyModel>(); Assert.Equal(2, result.Count()); }
public void GetCount() { var repository = ArticleRepository.Create(); this.CreateArticle(repository, SeedArticle.Create()); var service = this.GetArticlesService(repository); var result = service.GetCount(); Assert.Equal(1, result); }
public void GetLatesMostViewedTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var secondArticle = this.CreateArticle(repository, SeedArticle.CreateSecondArticle()); var service = this.GetArticlesService(repository); var result = service.GetLatesMostViewed <ArticleDumyModel>(); Assert.Equal(secondArticle.Id, result.First().Id); }
public void GetCountBySubCategoryIdOneMatchTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var secondArticle = this.CreateArticle(repository, SeedArticle.CreateSecondArticle()); var service = this.GetArticlesService(repository); var result = service.GetCountBySubCategoryId(1); Assert.Equal(1, result); }
public void GetSumAllSeensTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var secondArticle = this.CreateArticle(repository, SeedArticle.CreateSecondArticle()); var service = this.GetArticlesService(repository); var result = service.GetSumAllSeens(); Assert.Equal(3, result); }
public void DeleteByIdTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var secondArticle = this.CreateArticle(repository, SeedArticle.CreateSecondArticle()); var service = this.GetArticlesService(repository); service.DeleteById(article.Id).GetAwaiter(); Assert.Equal(1, repository.All().Count()); }
public void GetAllBySubCategoryIdOneMatchTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var secondArticle = this.CreateArticle(repository, SeedArticle.CreateSecondArticle()); var service = this.GetArticlesService(repository); var result = service.GetAllBySubCategoryId <ArticleDumyModel>(1); Assert.Single(result); }
public void GetAllByAtuthorIdDeletedNoMatchesTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var secondArticle = this.CreateArticle(repository, SeedArticle.CreateSecondArticle()); var service = this.GetArticlesService(repository); var result = service.GetAllByAtuthorIdDeleted <ArticleDumyModel>(article.AuthorId); Assert.Empty(result); }
public void GetLatestByRegionNoMatcheshTest() { var region = Region.Sofia_District; var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var secondArticle = this.CreateArticle(repository, SeedArticle.CreateSecondArticle()); var service = this.GetArticlesService(repository); var result = service.GetLatestByRegion <ArticleDumyModel>(region); Assert.Empty(result); }
public void AddToSeenCountTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var service = this.GetArticlesService(repository); var seenCount = article.SeenCount; service.AddToSeenCount(article.Id).GetAwaiter().GetResult(); Assert.Equal(seenCount + 1, article.SeenCount); }
public void GetLastByCreatedOnTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var secondArticle = this.CreateArticle(repository, SeedArticle.CreateSecondArticle()); var thirdArticle = this.CreateArticle(repository, SeedArticle.CreateThirdArticle()); var service = this.GetArticlesService(repository); var result = service.GetLastByCreatedOn <ArticleDumyModel>().GetAwaiter().GetResult(); Assert.Equal(thirdArticle.Id, result.Id); }
public void GetLatesMostCommentedTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var secondArticle = this.CreateArticle(repository, SeedArticle.CreateSecondArticle()); var thirdArticle = this.CreateArticle(repository, SeedArticle.CreateThirdArticle()); var service = this.GetArticlesService(repository); var result = service.GetLatesMostCommented <ArticleDumyModel>(); Assert.Empty(result); }
public void GetLatesInternationalArticlesoneMatchTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var secondArticle = this.CreateArticle(repository, SeedArticle.CreateSecondArticle()); var thirdArticle = this.CreateArticle(repository, SeedArticle.CreateThirdArticle()); var service = this.GetArticlesService(repository); var result = service.GetLatesInternationalArticles <ArticleDumyModel>(1); Assert.Single(result); }
public void GetLatesInternationalArticlesTwoMatchesTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var secondArticle = this.CreateArticle(repository, SeedArticle.CreateSecondArticle()); var thirdArticle = this.CreateArticle(repository, SeedArticle.CreateThirdArticle()); var service = this.GetArticlesService(repository); var result = service.GetLatesInternationalArticles <ArticleDumyModel>(); Assert.Equal(2, result.Count()); }
public void GetLatestByRegionOneMatchTest() { var region = Region.Burgas; var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var secondArticle = this.CreateArticle(repository, SeedArticle.CreateSecondArticle()); var service = this.GetArticlesService(repository); var result = service.GetLatestByRegion <ArticleDumyModel>(region); Assert.Single(result); }
public void GetAllByAtuthorIdDeletedOneMatchTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var secondArticle = this.CreateArticle(repository, SeedArticle.CreateSecondArticle()); repository.Delete(article); repository.SaveChangesAsync().GetAwaiter().GetResult(); var service = this.GetArticlesService(repository); var result = service.GetAllByAtuthorIdDeleted <ArticleDumyModel>(article.AuthorId); Assert.Single(result); }
public void UndeleteByIdTest() { var repository = ArticleRepository.Create(); var article = this.CreateArticle(repository, SeedArticle.Create()); var secondArticle = this.CreateArticle(repository, SeedArticle.CreateSecondArticle()); repository.Delete(article); repository.SaveChangesAsync().GetAwaiter().GetResult(); Assert.Equal(1, repository.All().Count()); var service = this.GetArticlesService(repository); service.UndeleteById(article.Id).GetAwaiter(); Assert.Equal(2, repository.All().Count()); }