public async Task And_UpdateProviderPaymentsPriority_Succeeds_Then_Redirect_To_Home(
            Mock <ICommitmentsApiClient> mockCommitmentsApiClient,
            UpdateProviderPaymentsPriorityRequest request,
            PaymentOrderViewModel viewModel,
            [Frozen] Mock <IModelMapper> mockMapper,
            PaymentOrderController controller)
        {
            mockMapper
            .Setup(mapper => mapper.Map <UpdateProviderPaymentsPriorityRequest>(viewModel))
            .ReturnsAsync(request);

            mockCommitmentsApiClient
            .Setup(r => r.UpdateProviderPaymentsPriority(
                       It.IsAny <long>(),
                       It.IsAny <UpdateProviderPaymentsPriorityRequest>(),
                       It.IsAny <CancellationToken>()))
            .Returns(Task.CompletedTask);

            var expectedRouteValues = new RouteValueDictionary(new
            {
                viewModel.AccountHashedId
            });

            var result = (await controller.ProviderPaymentOrder(viewModel)) as RedirectToActionResult;

            result.Should().NotBeNull();
            result.ActionName.Should().Be("Index");
            result.ControllerName.Should().Be("Home");
            result.RouteValues.Should().BeEquivalentTo(expectedRouteValues);
        }
        public async Task And_UpdateProviderPaymentsPriority_Fails_Then_Redirect_To_Error(
            PaymentOrderViewModel viewModel,
            [Frozen] Mock <IModelMapper> mockMapper,
            PaymentOrderController controller)
        {
            mockMapper
            .Setup(mapper => mapper.Map <UpdateProviderPaymentsPriorityRequest>(viewModel))
            .ThrowsAsync(new Exception("Some error"));

            var result = (await controller.ProviderPaymentOrder(viewModel)) as RedirectToActionResult;

            result.Should().NotBeNull();
            result.ActionName.Should().Be("Error");
            result.ControllerName.Should().Be("Error");
            result.RouteValues.Should().BeNull();
        }
        public async Task Then_Returns_View_With_Correct_Model(
            PaymentOrderRequest request,
            PaymentOrderViewModel viewModel,
            [Frozen] Mock <IModelMapper> mockMapper,
            PaymentOrderController controller)
        {
            mockMapper
            .Setup(mapper => mapper.Map <PaymentOrderViewModel>(request))
            .ReturnsAsync(viewModel);

            var result = await controller.ProviderPaymentOrder(request) as ViewResult;

            result.ViewName.Should().BeNull();
            var model = result.Model as PaymentOrderViewModel;

            model.Should().BeSameAs(viewModel);
        }