Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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);
        }