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); }
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]()); }