Пример #1
0
        public async void GetLostDogCommentSuccessfulForExistingDogAndComment()
        {
            var saveDog = GetValidDog();
            var result  = await lostDogRepository.AddLostDog(saveDog);

            Assert.True(result.Successful);
            var comment = GetValidComment();

            comment.DogId = result.Data.Id;
            var commentResult = await lostDogRepository.AddLostDogComment(comment);

            Assert.True(commentResult.Successful);
            var removeResult = await lostDogRepository.GetLostDogComment(commentResult.Data.DogId, commentResult.Data.Id);

            Assert.True(removeResult.Successful);
        }
        public async Task <ServiceResponse <GetCommentDto> > GetLostDogComment(int dogId, int commentId)
        {
            var repoResponse = await lostDogDataRepository.GetLostDogComment(dogId, commentId);

            var serviceResponse = mapper.Map <ServiceResponse <GetCommentDto> >(repoResponse);

            if (!serviceResponse.Successful)
            {
                serviceResponse.StatusCode = StatusCodes.Status400BadRequest;
            }
            return(serviceResponse);
        }