private void LikePosts()
 {
     for (int i = 0; i < 10; i++)
     {
         PostService.LikeDislikePost(PostMockings.GetGuid(i % 2), PostMockings.GetGuid(i + 2)).GetAwaiter().GetResult();
     }
 }
        public void TestLikeDislike()
        {
            var post = PostService.LikeDislikePost(PostMockings.GetGuid(0), PostMockings.GetGuid(1)).GetAwaiter()
                       .GetResult();

            Assert.IsTrue(post.IsLiked);
            post = PostService.LikeDislikePost(PostMockings.GetGuid(0), PostMockings.GetGuid(1)).GetAwaiter()
                   .GetResult();
            Assert.IsFalse(post.IsLiked);
        }
        public void TestGetPostsByUserWithCurrentUserPart()
        {
            var posts = new List <PostViewModel>();

            for (int i = 1; i < 3; i++)
            {
                posts.AddRange(PostService
                               .GetPostsByUser(PostMockings.GetGuid(0), PostMockings.GetGuid(1), posts.Count == 0 ? DateTimeOffset.Now : posts.Last().PostDate, 1)
                               .GetAwaiter().GetResult());
                Assert.AreEqual(posts.Min(post => post.PostDate), posts.Last().PostDate);
                Assert.AreEqual(i, posts.Count);
            }
        }
        public void TestUpdatePost()
        {
            var mock = PostMockings.Posts.FirstOrDefault();

            mock.Title = "Changed title";
            mock.Neighborhoods.RemoveAt(0);
            mock.PostPictures.Add(new PostPicture {
                PictureUrl = "NewPicture"
            });
            var post = PostService.UpdatePost(mock, PostMockings.GetGuid(0)).GetAwaiter().GetResult();

            Assert.AreEqual(mock.Title, post.Title);
        }
        public void TestGetPostsByUserWithCurrentUser()
        {
            var posts = PostService.GetPostsByUser(PostMockings.GetGuid(0), PostMockings.GetGuid(1)).GetAwaiter().GetResult();

            Assert.AreEqual(3, posts.Count);
        }
        public void TestGetAllPostsWithCurrentUser()
        {
            var posts = PostService.GetAllPosts(PostMockings.GetGuid(0)).GetAwaiter().GetResult();

            Assert.AreEqual(27, posts.Count);
        }
        public void TestGetPost()
        {
            var post = PostService.GetPost(PostMockings.GetGuid(1), PostMockings.GetGuid(2)).GetAwaiter().GetResult();

            Assert.AreEqual(PostMockings.GetGuid(0), post.Id);
        }
 public void TestLikeDislikePostNotFound()
 {
     var post = PostService.LikeDislikePost(PostMockings.GetGuid(31), PostMockings.GetGuid(1)).GetAwaiter()
                .GetResult();
 }