public async Task <IActionResult> ApprovalData([FromBody] ApprovalVBFormDto data)
        {
            try
            {
                VerifyUser();

                var result = await _service.ApprovalData(data);


                var response = new ResultFormatter(ApiVersion, General.CREATED_STATUS_CODE, General.OK_MESSAGE).Ok(null, result);

                return(Ok(response));
            }
            catch (Exception e)
            {
                var result =
                    new ResultFormatter(ApiVersion, General.INTERNAL_ERROR_STATUS_CODE, e.Message)
                    .Fail();
                return(StatusCode(General.INTERNAL_ERROR_STATUS_CODE, result));
            }
        }
        public async Task ApproveData_Return_Succes()
        {
            //Setup
            FinanceDbContext dbContext = _dbContext(GetCurrentAsyncMethod());

            VBRequestDocumentService   service = new VBRequestDocumentService(dbContext, GetServiceProvider().Object);
            VBRequestDocumentWithPODto data    = GetdataUtil(service).GetTestData_VBRequestDocumentWithPO();

            ApprovalVBFormDto approvalVBFormDto = new ApprovalVBFormDto()
            {
                IsApproved = true,
                Ids        = new List <int>()
                {
                    data.Id
                },
                Bank = new Lib.ViewModels.NewIntegrationViewModel.AccountBankViewModel {
                    Id            = 1,
                    Code          = "BankTest",
                    AccountCOA    = "BankCoaTest",
                    AccountName   = "BankAccountNameTest",
                    AccountNumber = "BankAccountNumberTest",
                    BankCode      = "BankBankCodeTest",
                    BankName      = "BankBankNameTestst",
                    Currency      = new Lib.ViewModels.NewIntegrationViewModel.CurrencyViewModel
                    {
                        Code        = "CurrencyCodeTest",
                        Id          = 1,
                        Description = "CurrencyDescriptionTEst",
                        Rate        = 1,
                        Symbol      = "Sy"
                    }
                }
            };
            //Act
            int result = await service.ApprovalData(approvalVBFormDto);

            //Assert
            Assert.True(0 < result);
        }
Esempio n. 3
0
        public async Task ApproveData_Return_Succes()
        {
            //Setup
            FinanceDbContext dbContext = _dbContext(GetCurrentAsyncMethod());

            VBRequestDocumentService   service = new VBRequestDocumentService(dbContext, GetServiceProvider().Object);
            VBRequestDocumentWithPODto data    = GetdataUtil(service).GetTestData_VBRequestDocumentWithPO();

            ApprovalVBFormDto approvalVBFormDto = new ApprovalVBFormDto()
            {
                IsApproved = true,
                Ids        = new List <int>()
                {
                    data.Id
                }
            };
            //Act
            int result = await service.ApprovalData(approvalVBFormDto);

            //Assert
            Assert.True(0 < result);
        }