public async Task MakeDeposit_Post_WhenModelIsValid()
        {
            //Arrage
            var mockCreditRepository = new Mock <IDepositRepository>();
            var mockMediator         = new Mock <IMediator>();
            var testModel            = GetTestTakeDepositViewModel();

            var controller = new DepositController(mockMediator.Object, mockCreditRepository.Object);

            //Act
            var result = await controller.MakeDeposit(testModel);

            //Assert
            var redirectToActionResult = Assert.IsType <ViewResult>(result);
            //TODO:
        }
        public async Task MakeDeposit_Post_WhenModelIsInvalid()
        {
            //Arrage
            var mockCreditRepository = new Mock <IDepositRepository>();
            var mockMediator         = new Mock <IMediator>();
            var testModel            = GetTestTakeDepositViewModel();

            var controller = new DepositController(mockMediator.Object, mockCreditRepository.Object);

            controller.ModelState.AddModelError("IdClient", "Required");

            //Act
            var result = await controller.MakeDeposit(testModel);

            //Assert
            Assert.False(controller.ModelState.IsValid);
            Assert.True(controller.ModelState.Count == 1);
        }
        public async Task MakeDeposit_Get_WhenDepositIsNull()
        {
            //Arrage
            var mockDepositRepository = new Mock <IDepositRepository>();
            var mockMediator          = new Mock <IMediator>();

            mockMediator
            .Setup(m =>
                   m.Send(It.IsAny <GetBankAccountsWithoutActiveDepositQuery>(),
                          It.IsAny <CancellationToken>()))
            .ReturnsAsync(GetEmptyListBankAccounts())
            .Verifiable();

            var controller = new DepositController(mockMediator.Object, mockDepositRepository.Object);

            //Act
            var result = await controller.MakeDeposit(idClient : 3);

            //Assign
            var redirect = Assert.IsType <RedirectToActionResult>(result);

            Assert.Equal("NonAccounts", redirect.ActionName);
        }
        public async Task MakeDeposit_Get_WhenDepositIsNotNull()
        {
            //Arrage
            var mockDepositRepository = new Mock <IDepositRepository>();
            var mockMediator          = new Mock <IMediator>();

            mockMediator
            .Setup(m =>
                   m.Send(It.IsAny <GetBankAccountsWithoutActiveDepositQuery>(),
                          It.IsAny <CancellationToken>()))
            .ReturnsAsync(GetListBankAccounts())
            .Verifiable();

            var controller = new DepositController(mockMediator.Object, mockDepositRepository.Object);

            //Act
            var result = await controller.MakeDeposit(idClient : 3);

            //Assign
            var request = Assert.IsType <ViewResult>(result);
            var model   = Assert.IsAssignableFrom <MakeDepositViewModel>(request.ViewData.Model);

            Assert.Equal(expected: 3, model.IdClient);
        }