public async Task ThenIShouldGetASuccessMessage() { //Arrange _mediator.Setup(x => x.SendAsync(It.IsAny <RemoveTeamMemberCommand>())).ReturnsAsync(Unit.Value); //Act var result = await _orchestrator.Remove(2, "3242", "32342"); //Assert Assert.AreEqual(HttpStatusCode.OK, result.Status); Assert.AreEqual("Team member removed", result.FlashMessage.Headline); Assert.AreEqual($"You've removed <strong>{Email}</strong>", result.FlashMessage.Message); }
public async Task <ActionResult> Remove(long userId, string hashedAccountId, string email, int remove) { Exception exception; HttpStatusCode httpStatusCode; try { if (remove != 1) { return(RedirectToAction("ViewTeam", new { HashedAccountId = hashedAccountId })); } var response = await _employerTeamOrchestrator.Remove(userId, hashedAccountId, OwinWrapper.GetClaimValue(@"sub")); return(View("ViewTeam", response)); } catch (InvalidRequestException e) { httpStatusCode = HttpStatusCode.BadRequest; exception = e; } catch (UnauthorizedAccessException e) { httpStatusCode = HttpStatusCode.Unauthorized; exception = e; } var errorResponse = await _employerTeamOrchestrator.Review(hashedAccountId, email); errorResponse.Status = httpStatusCode; errorResponse.Exception = exception; return(View(errorResponse)); }
public async Task ThenIShouldGetASuccessMessage() { //Assign var email = "*****@*****.**"; _mediator.Setup(x => x.SendAsync(It.IsAny <GetUserQuery>())).ReturnsAsync(new GetUserResponse { User = new User { Email = email } }); _mediator.Setup(x => x.SendAsync(It.IsAny <RemoveTeamMemberCommand>())).ReturnsAsync(Unit.Value); //Act var result = await _orchestrator.Remove(2, "3242", "32342"); //Assert Assert.AreEqual(HttpStatusCode.OK, result.Status); Assert.AreEqual("Team member removed", result.FlashMessage.Headline); Assert.AreEqual($"You've removed <strong>{email}</strong>", result.FlashMessage.Message); }