Exemplo n.º 1
0
        public async void Follow_HappyPath_ShouldReturnOkObject()
        {
            var followeeId = "1";

            _mockRepository.Setup(g => g.IsExist(followeeId, _userId)).ReturnsAsync(false);

            var result = await _controller.Follow(followeeId);

            result.Should().BeOfType <OkObjectResult>();
        }
        public void Follow_UserFollowingAnArtistForWhichHeIsFollowing_ShouldReturnBadRequest()
        {
            var following = new Following();

            _mockRepository.Setup(r => r.GetFollowing("1", _userId)).Returns(following);
            var result = _controller.Follow(new FollowingDto {
                FolloweeId = "1"
            });

            result.Should().BeOfType <BadRequestErrorMessageResult>();
        }
Exemplo n.º 3
0
        public void Follow_AlreadyFollowingUser_ShouldReturnBadRequest()
        {
            var following = new Following();

            _mockRepository.Setup(r => r.GetFollowing(_userId, "2")).Returns(following);

            var result = _controller.Follow(new FollowingDto {
                FolloweeId = "2"
            });

            result.Should().BeOfType <BadRequestErrorMessageResult>();
        }
        public void Follow_UserAttemptToFollowAnArtistHeAlreadyHasFollowed_ShouldReturnBadRequest()
        {
            var artistId  = "1";
            var following = new Following();

            _repository.Setup(f => f.GetFollowing(artistId, _userId)).Returns(following);

            var result = _controller.Follow(new FollowingDto {
                FolloweeId = artistId
            });

            result.Should().BeOfType <BadRequestErrorMessageResult>();
        }
Exemplo n.º 5
0
        public void Follow_FollowingExists_ShouldReturnBadRequest()
        {
            // arrange
            var followDto = new FollowingDto {
                FolloweeId = "1"
            };

            _mockRepo.Setup(r => r.IsFollowing(_userId, "1")).Returns(true);

            // act
            var res = _controller.Follow(followDto);

            // assert
            res.Should().BeOfType <BadRequestErrorMessageResult>();
        }
Exemplo n.º 6
0
        public void Follow_AttemptingToReFollow_ShouldReturnBadRequest()
        {
            // Arrange
            var followingDto = new FollowingDto {
                FolloweeId = _UserId + "-"
            };
            var following = new Following();

            _mockFollowingsRepository.Setup(r => r.GetFollowing(_UserId, _UserId + "-")).Returns(following);

            // Act
            var result = _controller.Follow(followingDto).Result;

            // Assert
            Assert.IsInstanceOf <BadRequestErrorMessageResult>(result);
        }
        public void Follow_NoArtistWithGivenIdExist_ShouldReturnNotFound()
        {
            var dto = new FollowingDto
            {
                FolloweeId = "werwer-werwer-werwer"
            };

            var result = _controller.Follow(dto);

            result.Should().BeOfType <NotFoundResult>();
        }