Exemplo n.º 1
0
        public void Output_Success_Approval()
        {
            // Arrange
            var output = new GetEditAvatarOutput(DiverFactory.JohnDoeDiverId, DiverFactory.JohnDoeFullname);

            // Act
            presenter.Output(output);
            var viewModel = presenter.GetViewModel();

            // Assert
            viewModel.Realname.Should().Be(DiverFactory.JohnDoeFullname);
            viewModel.UserId.Should().Be(DiverFactory.JohnDoeDiverId);
            VerifyObjectJson(viewModel);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> EditAvatar(Guid id)
        {
            var presenter     = new MvcGetEditAvatarPresenter();
            var useCaseResult = await mediator.Send(new GetEditAvatar(id, presenter));

            if (useCaseResult.IsSuccessful)
            {
                return(View(presenter.GetViewModel()));
            }

            var map = new Dictionary <ResultCategory, Func <IActionResult> >
            {
                { ResultCategory.NotFound, NotFound },
                { ResultCategory.AccessDenied, Forbid },
                { ResultCategory.GeneralFailure, () => StatusCode(500) },
            };

            return(map[useCaseResult.ResultCategory]());
        }