public void DB() { var articleInfoService = new ArticleInfoService(); //添加测试数据 articleInfoService.Repository.Insert(new ArticleInfo { Id = 1, ArticleTitle = "test", ArticleContent = "content", ArticleCateSub = "1", //ArticleCate = 1, ArticleCode = Guid.NewGuid(), ArticleComment = "comment", //ArticleContentEdit = "edit", ArticleStatus = "new", ArticleURL = "abc/123.html", CreatedDate = DateTime.Now, CreatedUserID = "me", IsDeleted = false, LanguageCode = "zh", ReadCount = 0, UpdatedDate = DateTime.Now }); var article = articleInfoService.GetList <ArticleInfoView>(x => x.Id > 0); Assert.IsTrue(article.Count == 1); }
public void GetArticleThumbup() { var service = new ArticleInfoService(); var list = service.GetList <ArticleInfoView>(x => x.Id == 68, new PageCondition()); Assert.IsTrue(list.Count == 1); }
public void Encryption() { var service = new ArticleInfoService(); const string id = "abdeind0393"; var encryptionStr = service.EncryptorLillyid(id); var orginStr = EncryptionHelper.Decrypt(encryptionStr, CommonService.lstSysConfig.First(x => x.ConfigName == "UrlEncryptionKey").ConfigValue); Assert.IsTrue(id == orginStr); }
public void GetArticleInfoThumbsup() { var service = new ArticleInfoService(); var list = new List <int> { 1, 2 }; //var r = service.Repository.Entities.Where(x => list.Contains(x.Id)).Select(x => new //{ // article = x, // ArticleThumbsUps = x.ArticleThumbsUps.Where(y => y.ArticleID // == x.Id && y.IsDeleted != true).ToList() //}).ToList(); //Assert.IsTrue(r.Count(x => x.ArticleThumbsUps.Count == 2) == 2); }
public void Like() { var service = new ArticleInfoService(); service.UpdateArticleThumbsUp(1, "abc", "Article"); }