public async Task <ActionResult> Invite(InviteTeamMemberViewModel model) { var response = await _employerTeamOrchestrator.InviteTeamMember(model, OwinWrapper.GetClaimValue(@"sub")); if (response.Status == HttpStatusCode.OK) { var flashMessage = new FlashMessageViewModel { HiddenFlashMessageInformation = "page-invite-team-member-sent", Severity = FlashMessageSeverityLevel.Success, Headline = "Invitation sent", Message = $"You've sent an invitation to <strong>{model.Email}</strong>" }; AddFlashMessageToCookie(flashMessage); return(RedirectToAction("ViewTeam")); } model.ErrorDictionary = response.FlashMessage.ErrorMessages; var errorResponse = new OrchestratorResponse <InviteTeamMemberViewModel> { Data = model, FlashMessage = response.FlashMessage, }; return(View(errorResponse)); }
public async Task ThenIShouldGetBackAnUpdatedTeamMembersListWithTheCorrectSuccessMessage() { //Arrange var request = new InviteTeamMemberViewModel() { Email = "*****@*****.**" }; var response = new GetAccountTeamMembersResponse(); _mediator.Setup(x => x.SendAsync(It.IsAny <CreateInvitationCommand>())).ReturnsAsync(Unit.Value); _mediator.Setup(x => x.SendAsync(It.IsAny <GetAccountTeamMembersQuery>())).ReturnsAsync(response); //Act var result = await _orchestrator.InviteTeamMember(request, "37648"); //Assert Assert.IsNotNull(result); Assert.AreEqual(HttpStatusCode.OK, result.Status); }