Example #1
0
        public async Task GetVideosByMovieId_ShouldReturn_BadRequest_WhenProvidingInvalidId()
        {
            var response = new GetMovieVideosResultViewModel
            {
                Error = new Error
                {
                    Success        = false,
                    Status_Code    = 34,
                    Status_Message = "The resource you requested could not be found."
                },
            };

            _mediator.Setup(m => m.Send(It.IsAny <GetVideosByMovieIdRequest>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(response);

            var badResult = await _movieController.GetMovieVideos(-123);

            Assert.IsType <BadRequestObjectResult>(badResult);
        }
Example #2
0
        public async Task GetVideosByMovieId_ShouldReturn_Ok_WhenProvidingCorrectId()
        {
            var response = new GetMovieVideosResultViewModel
            {
                Id      = 123,
                Results = new List <GetMovieVideoViewModel>
                {
                    new GetMovieVideoViewModel
                    {
                        Id         = "533ec652c3a3685448000101",
                        Iso_639_1  = "en",
                        Iso_3166_1 = "US",
                        Key        = "6WcJbPlAknw",
                        Name       = "Lord of the Rings [1978] - One to Rule Them All",
                        Site       = "YouTube",
                        Size       = 360,
                        Type       = "Clip"
                    },
                    new GetMovieVideoViewModel
                    {
                        Id         = "5f7ad63c7b7b4d003a7584f0",
                        Iso_639_1  = "en",
                        Iso_3166_1 = "US",
                        Key        = "9qhL2_UxXM0",
                        Name       = "The Lord of the Rings (1978) Trailer.",
                        Site       = "YouTube",
                        Size       = 1080,
                        Type       = "Trailer"
                    }
                },
                Error = null
            };

            _mediator.Setup(m => m.Send(It.IsAny <GetVideosByMovieIdRequest>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(response);

            var okResult = await _movieController.GetMovieVideos(123);

            Assert.IsType <OkObjectResult>(okResult);
        }