예제 #1
0
        public async Task <IActionResult> Details(Guid id, SelectionViewModel selection)
        {
            if (await _movieService.AddActorAsync(id, selection.Selected) == null)
            {
                return(RedirectToAction(nameof(Details), new { Id = id }));
            }

            return(RedirectToAction(nameof(Details)));
        }
예제 #2
0
        public async Task AddActor()
        {
            var actor    = CreateActors().First();
            var actorDto = Map(actor);

            _mockingHelper.RepositoryMovie
            .Setup(_ => _.AddActorAsync(It.IsAny <Actor>()))
            .ReturnsAsync(It.IsAny <long>());

            _mockingHelper.RepositoryMovie
            .Setup(_ => _.GetActorByIdAsync(It.IsAny <long>()))
            .ReturnsAsync(actor);

            var result = await _movieService.AddActorAsync(actorDto);

            result.Should().BeEquivalentTo(actorDto);
        }