Example #1
0
        public void AddMovieAsyncTest()
        {
            var resultDto = new ResultDto
            {
                Title = "Success"
            };

            _fixture.MockService.Setup(_ => _.AddMovieAsync(It.IsAny <SearchMovie>(), Convert.ToInt32(TestConsts.Id))).ReturnsAsync(resultDto);
            var controller = new MovieController(_fixture.MockService.Object, _fixture.Mapper)
            {
                ControllerContext = _fixture.ControllerContextWithSession()
            };

            var result = controller.AddMovieAsync(JsonConvert.SerializeObject(new SearchMovie()));

            var viewResult = Assert.IsType <PartialViewResult>(result.Result);

            Assert.IsType <ResultViewModel>(viewResult.Model);
        }