public async Task Should_Set_Correct_LikeType(int likeType, LikeTypeEnum expectedType)
        {
            // Setup
            var comment = new Comment
            {
                Id    = 1,
                Likes = new LikesCollection(),
                Post  = new Post
                {
                    Wall = new Wall
                    {
                        OrganizationId = 2
                    }
                }
            };

            _commentsDbSet.SetDbSetDataForAsync(new List <Comment> {
                comment
            }.AsQueryable());

            // Act
            await _commentService.ToggleLikeAsync(new AddLikeDto { Id = comment.Id, Type = (LikeTypeEnum)likeType },
                                                  new UserAndOrganizationDto { UserId = "user1", OrganizationId = 2 });

            // Assert
            Assert.AreEqual(expectedType, _commentsDbSet.First().Likes.First().Type);
        }
Esempio n. 2
0
        public List <UserBase> FindLikerListByLikeType(long likeTargetID, LikeTypeEnum likeType)
        {
            DataTable dt = dal.FindLikerListByLikeType(likeTargetID, likeType.GetHashCode());

            return(ModelConvertHelper <UserBase> .ConvertToList(dt));
        }
Esempio n. 3
0
 public Like(string userId, LikeTypeEnum type)
 {
     UserId  = userId;
     Created = DateTime.UtcNow;
     Type    = type;
 }