Inheritance: AllReady.Areas.Admin.ViewModels.Itinerary.RequestListViewModel
        public async Task RemoveRequestRedirectsToCorrectActionWithCorrrectRouteValues()
        {
            var viewModel = new RequestSummaryViewModel { ItineraryId = 1, UserIsOrgAdmin = true };

            var mediator = new Mock<IMediator>();
            var sut = new ItineraryController(mediator.Object, null);

            var result = await sut.RemoveRequest(viewModel) as RedirectToActionResult;

            var routeValueDictionary = new RouteValueDictionary { ["id"] = viewModel.ItineraryId };

            Assert.Equal(result.ActionName, "Details");
            Assert.Equal(result.RouteValues, routeValueDictionary);
        }
        public async Task ConfirmRemoveRequestAssignsCorrectTitleOnViewModel()
        {
            const int orgId = 1;
            var requestId = Guid.NewGuid();
            var viewModel = new RequestSummaryViewModel { Name = "ViewModelName" };

            var mediator = new Mock<IMediator>();
            mediator.Setup(x => x.SendAsync(It.IsAny<OrganizationIdQuery>())).ReturnsAsync(orgId);
            mediator.Setup(x => x.SendAsync(It.IsAny<RequestSummaryQuery>())).ReturnsAsync(viewModel);

            var sut = new ItineraryController(mediator.Object, null);
            sut.MakeUserAnOrgAdmin(orgId.ToString());

            var result = await sut.ConfirmRemoveRequest(It.IsAny<int>(), requestId) as ViewResult;
            var resultViewModel = result.ViewData.Model as RequestSummaryViewModel;

            Assert.Equal(resultViewModel.Title, $"Remove request: {viewModel.Name}");
        }
        public async Task RemoveRequestSendsRemoveRequestCommandWithCorrectData()
        {
            var viewModel = new RequestSummaryViewModel { Id = Guid.NewGuid(), ItineraryId = 1, UserIsOrgAdmin = true };

            var mediator = new Mock<IMediator>();
            var sut = new ItineraryController(mediator.Object, null);

            await sut.RemoveRequest(viewModel);

            mediator.Verify(x => x.SendAsync(It.Is<RemoveRequestCommand>(y => y.RequestId == viewModel.Id && y.ItineraryId == viewModel.ItineraryId)));
        }
        public async Task<IActionResult> RemoveRequest(RequestSummaryViewModel viewModel)
        {
            if(!viewModel.UserIsOrgAdmin)
            { 
                return Unauthorized();
            }

            await _mediator.SendAsync(new RemoveRequestCommand { RequestId = viewModel.Id, ItineraryId = viewModel.ItineraryId });

            return RedirectToAction(nameof(Details), new { id = viewModel.ItineraryId });
        }