Exemplo n.º 1
0
        public void PostType_GetPostTypeByPostId()
        {
            var db       = new RepositoryBody();
            var PostType = db.GetPostTypeByPostId(19);

            Assert.Equal(1, PostType.Id);
        }
Exemplo n.º 2
0
        public void CountPosts_ReturnsPostsNumbers()
        {
            var db        = new RepositoryBody();
            int postCount = db.CountPosts();

            Assert.Equal(13629, postCount);
        }
Exemplo n.º 3
0
        public void UserCustomField_GetUserCustomeFieldById()

        {
            var db   = new RepositoryBody();
            var Ftag = db.GetUserCustomeFieldById(2);

            Assert.Equal(3, Ftag.FavoriteTags.Count());
        }
Exemplo n.º 4
0
        public void QuestionByAnswerId_returnsListOf_Its_Answers()
        {
            var db           = new RepositoryBody();
            var parentId     = db.GetQuestionByAnswerId(71).Answers.First().ParentId;
            var SameParentId = db.GetQuestionByAnswerId(71).Id;

            Assert.Equal(parentId, SameParentId);
        }
Exemplo n.º 5
0
        public void UserInfo_GetUserByCommentId()
        {
            var db       = new RepositoryBody();
            var UserInfo = db.GetUserByCommentId(69759);

            Assert.Equal("Jeff Atwood", UserInfo.DisplayName);
            Assert.Equal("El Cerrito, CA", UserInfo.Location);
        }
Exemplo n.º 6
0
        public void FavoriteTags_GetEachTag()
        {
            var db        = new RepositoryBody();
            var tagsCount = db.GetFavoriteTagsByCustomeId(1).Count;
            var firstTag  = db.GetFavoriteTagsByCustomeId(1).First().Tag.Tag;

            Assert.Equal(3, tagsCount);
            Assert.Equal("java", firstTag);
        }
Exemplo n.º 7
0
        public void Comments_GetCommentsByPostId()
        {
            var db       = new RepositoryBody();
            var Comments = db.GetCommentsByPostId(52002, 0, 20);

            Assert.Equal(9, Comments.Count());
            Assert.Equal("A man, a plan, a canal, Panama", Comments.First().Body);
            Assert.Equal(15, Comments.First().Score);
        }
Exemplo n.º 8
0
        public void Search_MustBeOrdered_By_Rank()
        {
            var    db             = new RepositoryBody();
            string searchString   = "the best most common design patterns used for games";
            var    FirstPostScore = db.Search(searchString, 0, 5).First().Rank;
            var    LastPostScore  = db.Search(searchString, 0, 5).Last().Rank;

            Assert.True(FirstPostScore > LastPostScore);
        }
Exemplo n.º 9
0
        public void PostTags_GetPostTagsByPostId()
        {
            var db       = new RepositoryBody();
            var PostTags = db.GetPostTagsByPostId(26583319);
            var PostTag  = db.GetPostTagsByPostId(18332611);

            Assert.Equal(4, PostTags.Count());
            Assert.Equal("android", PostTag.First().Tag.Tag);
            Assert.Equal(1920, PostTag.First().TagId);
        }
Exemplo n.º 10
0
        public void Search_MustReturnValidValues_andSavedHistory()
        {
            var db         = new RepositoryBody();
            var foundTitle = db.Search("best gtk programming ide", 0, 5).Last().Title;

            Assert.Equal(foundTitle, "The best ide for gtk+ programming");
            var searchHistory = db.GetSearchHistories(0, 3);

            Assert.Equal("best gtk programming ide", searchHistory.First().SearchContent);
        }
Exemplo n.º 11
0
        public void Custome_FieldMakes_CustomPostLimit()
        {
            var db = new RepositoryBody();

            db.AddUserCustomeField(5, "C#, java");
            var id          = db.GetUserCustomeFields().Last().Id;
            var CustomePost = db.ShowCustomePosts();

            Assert.Equal(CustomePost.Count(), 5);
            Assert.Equal(db.DeleteUserCustomeField(id), true);
        }
Exemplo n.º 12
0
        public void CoOccurrence_ShouldReturn_ValidValues()
        {
            var db      = new RepositoryBody();
            var CoOccur = db.GetCoOccurrencesByWord("class", 0, 3).First();
            var word1   = CoOccur.Word;
            var word2   = CoOccur.Word2;
            var grade   = CoOccur.Grade;

            Assert.Equal(word1, "class");
            Assert.Equal(word2, "public");
            Assert.Equal(81, grade);
        }
Exemplo n.º 13
0
        public void AddCustomeField_Adds_FavoriteTags()
        {
            var db = new RepositoryBody();

            db.AddUserCustomeField(11, "assembly,robots");
            var id           = db.GetUserCustomeFields().Last().Id;
            var favoriteTags = db.GetFavoriteTagsByCustomeId(id);

            Assert.Equal(favoriteTags.First().Tag.Tag, "assembly");
            Assert.Equal(db.DeleteUserCustomeField(id), true);
            Assert.Empty(db.GetFavoriteTagsByCustomeId(id));
        }
Exemplo n.º 14
0
        public void FavoriteTag_GetFavoriteTagsByCustomeId()

        {
            var db = new RepositoryBody();

            var TotalFavtTags = db.GetFavoriteTagsByCustomeId(2).Count;

            var FavtTag = db.GetFavoriteTagsByCustomeId(1);

            Assert.Equal(3, TotalFavtTags);

            Assert.Equal(2726, FavtTag.First().TagId);
        }
Exemplo n.º 15
0
        static void Main(string[] args)
        {
            using (var db = new SovaContext())
            {
            }



            var rep = new RepositoryBody();

            var q = rep.ShowCustomePosts(26);

            Console.WriteLine(q.Count);
            Console.WriteLine(q.First().Title);
            Console.ReadLine();

            Console.WriteLine();
            Console.ReadLine();
        }
Exemplo n.º 16
0
        static void Main(string[] args)
        {
            using (var db = new SovaContext())
            {
            }



            var rep = new RepositoryBody();

            // rep.AddSearchHistory("whats your name");

            //   Console.WriteLine(rep.RemoveMarking(9033));
            Console.WriteLine(rep.Search("best gtk programming ide", 0, 5).Last().Title);
            Console.ReadLine();

            Console.WriteLine();
            Console.ReadLine();
        }