Пример #1
0
        public async Task GetMovieByTitle_Success()
        {
            getMovieByTitleRepositoryMock
            .Setup(e => e.GetMovieByTitleAsync(It.IsAny <MovieModel>()))
            .ReturnsAsync(TestResponseData());

            var data = await getMovieByTitleQueryHandler?.HandleAsync(this.GetMovieByTitleQueryData());

            int count = ((IReadOnlyCollection <MovieModel>)data).Count;

            Assert.AreEqual <int>(1, count);
        }
Пример #2
0
        async Task <IActionResult> IApiQueryHandler <GetMovieByTitleQuery> .HandleAsync(ControllerBase controllerBase, GetMovieByTitleQuery query)
        {
            try
            {
                if (query == null)
                {
                    return(controllerBase?.BadRequest());
                }

                return(controllerBase?.Ok(await getMovieByTitleQueryHandler?.HandleAsync(query)));
            }
            catch
            {
                throw;
            }
        }