Ejemplo n.º 1
0
        public void CanAdd()
        {
            using (var data = new DbTestData())
            {
                Guid userId        = data.user1.ID;
                Guid translationId = data.translation1.ID;

                dal.ReadById(userId, translationId).Should().BeNull();

                var newVote = dal.Add(new Vote(userId, translationId, true));

                dal.ReadById(userId, translationId).Should().NotBeNull();
                newVote.Should().NotBeNull();
                newVote.UserID.Should().Be(userId);
                newVote.TranslationID.Should().Be(translationId);
                newVote.IsUpvote.Should().BeTrue();

                dal.DeleteById(newVote.UserID, newVote.TranslationID);
            }
        }
Ejemplo n.º 2
0
 public Vote Add(Vote vote, Guid authenticatedUserId)
 {
     vote.UserID = authenticatedUserId;
     return(_votesDAL.Add(vote));
 }