コード例 #1
0
        public async Task GetMovieByReleaseDate_Success()
        {
            getMovieByReleaseDateRepositoryMock
            .Setup(e => e.GetMovieByReleaseDateAsync(It.IsAny <MovieModel>()))
            .ReturnsAsync(TestResponseData());

            var data = await getMovieByReleaseDateQueryHandler?.HandleAsync(this.GetMovieByReleaseDateQueryData());

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

            Assert.AreEqual <int>(1, count);
        }
        async Task <IActionResult> IApiQueryHandler <GetMovieByReleaseDateQuery> .HandleAsync(ControllerBase controllerBase, GetMovieByReleaseDateQuery query)
        {
            try
            {
                if (query == null)
                {
                    return(controllerBase.BadRequest());
                }

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