public async Task User_Should_Remove_Like_If_Not_Allowed()
        {
            var photoService = A.Fake <IPhotoService>();
            var photo        = GetPhoto();
            var user         = GetUser();
            var guid         = Guid.NewGuid();
            var unitOfWork   = new UnitOfWorkBuilder().Build();
            var like         = new Like {
                ReactionId = "1234", Reactor = user
            };

            photo.PhotoLikes = new List <PhotoLike>
            {
                new PhotoLike {
                    Photo = photo, Like = like
                }
            };
            await unitOfWork.Photos.Add(photo);

            A.CallTo(() => photoService.GetPhoto("1234")).Returns(Task.FromResult(photo));
            var reactionService = new ReactionServiceBuilder()
                                  .WithGuid(guid)
                                  .WithPhotoService(photoService)
                                  .WithUnitOfWork(unitOfWork)
                                  .WithPermissionsService(new AllPermissionsDeniedService())
                                  .Build();
            var sucessfullyDeleted = await reactionService.UnlikePhoto("1234", "AlbumId", user);

            sucessfullyDeleted.Should().BeFalse();
        }
        public async Task User_Should_Remove_Comment()
        {
            var photoService = A.Fake <IPhotoService>();
            var photo        = GetPhoto();
            var user         = GetUser();
            var guid         = Guid.NewGuid();
            var unitOfWork   = new UnitOfWorkBuilder().Build();
            var comment      = new Comment {
                ReactionId = "1234", Reactor = user, Text = "Héhé"
            };

            photo.PhotoComments = new List <PhotoComment>
            {
                new PhotoComment {
                    Photo = photo, Comment = comment
                }
            };
            await unitOfWork.Photos.Add(photo);

            A.CallTo(() => photoService.GetPhoto("1234")).Returns(Task.FromResult(photo));
            var reactionService = new ReactionServiceBuilder()
                                  .WithGuid(guid)
                                  .WithPhotoService(photoService)
                                  .WithUnitOfWork(unitOfWork)
                                  .WithPermissionsService(new AllPermissionsGrantedService())
                                  .Build();
            var sucessfullyDeleted = await reactionService.DeleteComment("1234", "AlbumId", "1234", user);

            var comments = await unitOfWork.Comments.GetAll();

            sucessfullyDeleted.Should().BeTrue();
            comments.Should().BeEmpty();
        }
        public async Task User_Should_Not_Like_If_Not_Allowed()
        {
            var photoService = A.Fake <IPhotoService>();
            var photo        = GetPhoto();
            var user         = GetUser();
            var guid         = Guid.NewGuid();

            A.CallTo(() => photoService.GetPhoto(photo.PhotoId)).Returns(photo);
            var reactionService = new ReactionServiceBuilder()
                                  .WithGuid(guid)
                                  .WithPhotoService(photoService)
                                  .WithPermissionsService(new AllPermissionsDeniedService())
                                  .Build();
            var like = await reactionService.LikePhoto("1234", "albumId", user);

            like.Should().BeNull();
        }
        public async Task User_Should_Comment()
        {
            var photoService = A.Fake <IPhotoService>();
            var photo        = GetPhoto();
            var user         = GetUser();
            var guid         = Guid.NewGuid();

            A.CallTo(() => photoService.GetPhoto(photo.PhotoId)).Returns(photo);
            var reactionService = new ReactionServiceBuilder()
                                  .WithPhotoService(photoService)
                                  .WithPermissionsService(new AllPermissionsGrantedService())
                                  .WithGuid(guid)
                                  .Build();

            var comment = await reactionService.AddComment("1234", "albumId", "This photo rocks !", user);

            comment.Should().NotBeNull();
            comment.ReactionId.Should().Be(guid.ToString());
        }
        public async Task Like_Should_Be_Stored()
        {
            var photoService = A.Fake <IPhotoService>();
            var photo        = GetPhoto();
            var user         = GetUser();
            var guid         = Guid.NewGuid();
            var unitOfWork   = new UnitOfWorkBuilder().Build();

            A.CallTo(() => photoService.GetPhoto(photo.PhotoId)).Returns(photo);
            var reactionService = new ReactionServiceBuilder()
                                  .WithGuid(guid)
                                  .WithPhotoService(photoService)
                                  .WithUnitOfWork(unitOfWork)
                                  .WithPermissionsService(new AllPermissionsGrantedService())
                                  .Build();
            var like = await reactionService.LikePhoto("1234", "albumId", user);

            var storedLike = await unitOfWork.Likes.GetAll(x => x.ReactionId == guid.ToString());

            storedLike.Should().NotBeNull();
            storedLike.Should().NotBeEmpty();
            storedLike.Should().ContainSingle();
            storedLike.Should().Contain(like);
        }