Esempio n. 1
0
        public async Task GetReports_Return_Success()
        {
            //Setup
            FinanceDbContext dbContext = _dbContext(GetCurrentMethod());
            var serviceProviderMock    = GetServiceProvider();

            VBRealizationDocumentExpeditionService service = new VBRealizationDocumentExpeditionService(dbContext, serviceProviderMock.Object);

            VBRealizationWithPOService vBRealizationWithPOService = new VBRealizationWithPOService(dbContext, serviceProviderMock.Object);
            var vBRealizationWithPODto = _dataUtil(vBRealizationWithPOService).GetTestData_TanpaNomorVB();

            VBRealizationDocumentExpeditionModel vbRealization = _dataUtil(service, dbContext).GetTestData_VBRealizationDocumentExpedition();


            var result1 = await service.GetReports(vbRealization.Id, vbRealization.VBRealizationId, vbRealization.VBRequestName, vbRealization.UnitId, vbRealization.DivisionId, DateTimeOffset.Now.AddDays(-2), DateTimeOffset.Now.AddDays(2), "UNIT", 1, 25);

            Assert.NotNull(result1);

            var result2 = await service.GetReports(vbRealization.Id, vbRealization.VBRealizationId, vbRealization.VBRequestName, vbRealization.UnitId, vbRealization.DivisionId, DateTimeOffset.Now.AddDays(-2), DateTimeOffset.Now.AddDays(2), "VERIFIKASI", 1, 25);

            Assert.NotNull(result2);

            var result3 = await service.GetReports(vbRealization.Id, vbRealization.VBRealizationId, vbRealization.VBRequestName, vbRealization.UnitId, vbRealization.DivisionId, DateTimeOffset.Now.AddDays(-2), DateTimeOffset.Now.AddDays(2), "KASIR", 1, 25);

            Assert.NotNull(result3);

            var result4 = await service.GetReports(vbRealization.Id, vbRealization.VBRealizationId, vbRealization.VBRequestName, vbRealization.UnitId, vbRealization.DivisionId, DateTimeOffset.Now.AddDays(-2), DateTimeOffset.Now.AddDays(2), "RETUR", 1, 25);

            Assert.NotNull(result4);
        }
Esempio n. 2
0
        public void ReadVerification_Return_Success()
        {
            FinanceDbContext dbContext = _dbContext(GetCurrentAsyncMethod());

            VBRealizationDocumentExpeditionService service = new VBRealizationDocumentExpeditionService(dbContext, GetServiceProvider().Object);
            VBRealizationDocumentExpeditionModel   model   = _dataUtil(service, dbContext).GetTestData_VBRealizationDocumentExpedition();
            var result = service.ReadVerification(1, 1, "{}", "", model.Position, model.VBId, model.VBRealizationId, model.VBRealizationDate, model.VBRequestName, model.UnitId);

            Assert.NotNull(result);
        }
Esempio n. 3
0
        public void Read_Return_Success()
        {
            FinanceDbContext dbContext = _dbContext(GetCurrentMethod());

            VBRealizationDocumentExpeditionService service = new VBRealizationDocumentExpeditionService(dbContext, GetServiceProvider().Object);

            var result = service.Read(1, 1, "{}", "", 0, 0, 0, null, null, 0);

            Assert.NotNull(result);
        }
Esempio n. 4
0
        public void ReadByIdAsync_Return_Success()
        {
            FinanceDbContext dbContext = _dbContext(GetCurrentAsyncMethod());

            VBRealizationDocumentExpeditionService service = new VBRealizationDocumentExpeditionService(dbContext, GetServiceProvider().Object);
            VBRequestDocumentModel model = _dataUtil(service, dbContext).GetTestData_VBRequestDocument();
            var result = service.ReadByIdAsync(model.Id);

            Assert.NotNull(result);
        }
Esempio n. 5
0
        public async Task UpdateExpeditionByRealizationId_Return_Success()
        {
            FinanceDbContext dbContext = _dbContext(GetCurrentAsyncMethod());

            VBRealizationDocumentExpeditionService service = new VBRealizationDocumentExpeditionService(dbContext, GetServiceProvider().Object);
            VBRealizationDocumentExpeditionModel   model   = _dataUtil(service, dbContext).GetTestData_VBRealizationDocumentExpedition();
            int result = await service.UpdateExpeditionByRealizationId(model.VBRealizationId);

            Assert.NotEqual(0, result);
        }
Esempio n. 6
0
        public void ReadRelizationToVerification_Return_Success()
        {
            FinanceDbContext dbContext = _dbContext(GetCurrentMethod());

            VBRealizationDocumentExpeditionService service = new VBRealizationDocumentExpeditionService(dbContext, GetServiceProvider().Object);

            ReadResponse <VBRealizationDocumentModel> result = service.ReadRealizationToVerification(0, 0, null, null, 0);

            Assert.NotNull(result);
        }
Esempio n. 7
0
        public void ReadRelizationToVerification_with_dataTest_Return_Success()
        {
            FinanceDbContext dbContext = _dbContext(GetCurrentMethod());

            VBRealizationDocumentExpeditionService service = new VBRealizationDocumentExpeditionService(dbContext, GetServiceProvider().Object);
            VBRealizationDocumentExpeditionModel   model   = _dataUtil(service, dbContext).GetTestData_VBRealizationDocumentExpedition();
            var result = service.ReadRealizationToVerification(model.VBId, model.VBRealizationId, model.VBRealizationDate, model.VBRequestName, model.UnitId);

            Assert.NotNull(result);
            //Assert.True(0 < result.Data.Count());
        }
Esempio n. 8
0
        public async Task VerificationDocumentReceipt_Return_Success()
        {
            FinanceDbContext dbContext = _dbContext(GetCurrentMethod());

            VBRealizationDocumentExpeditionService service = new VBRealizationDocumentExpeditionService(dbContext, GetServiceProvider().Object);
            VBRealizationDocumentExpeditionModel   model   = _dataUtil(service, dbContext).GetTestData_VBRealizationDocumentExpedition();
            var data   = model.VBRealizationId;
            int result = await service.VerificationDocumentReceipt(new List <int>() { data });

            Assert.NotEqual(0, result);
        }
Esempio n. 9
0
        public void Read_with_Data_Return_Success()
        {
            //Setup
            FinanceDbContext dbContext = _dbContext(GetCurrentMethod());
            VBRealizationDocumentExpeditionService service = new VBRealizationDocumentExpeditionService(dbContext, GetServiceProvider().Object);
            var data = _dataUtil(service, dbContext).GetTestData_VBRealizationDocumentExpedition();

            //Act
            var result = service.Read(1, 1, "{}", "", data.Position, data.VBId, data.VBRealizationId, data.VBRealizationDate, data.VBRequestName, data.UnitId);

            //Assert
            Assert.NotNull(result);
        }
Esempio n. 10
0
        public async Task SubmitToVerification_Return_Success()
        {
            FinanceDbContext dbContext = _dbContext(GetCurrentAsyncMethod());
            var serviceProvider        = GetServiceProvider();

            VBRealizationDocumentExpeditionService service = new VBRealizationDocumentExpeditionService(dbContext, serviceProvider.Object);

            VBRealizationWithPOService vBRealizationWithPOService = new VBRealizationWithPOService(dbContext, serviceProvider.Object);
            var data = _dataUtil(vBRealizationWithPOService).GetTestData_TanpaNomorVB();

            int result = await service.SubmitToVerification(new List <int>() { data.Id });

            Assert.NotEqual(0, result);
        }
Esempio n. 11
0
        public async Task VerifiedToCashier_Return_Success()
        {
            FinanceDbContext        dbContext           = _dbContext(GetCurrentMethod());
            Mock <IServiceProvider> serviceProviderMock = GetServiceProvider();

            VBRealizationWithPOService vBRealizationWithPOService = new VBRealizationWithPOService(dbContext, serviceProviderMock.Object);
            var vBRealizationWithPODto = _dataUtil(vBRealizationWithPOService).GetTestData_TanpaNomorVB();

            VBRealizationDocumentExpeditionService service = new VBRealizationDocumentExpeditionService(dbContext, serviceProviderMock.Object);
            VBRealizationDocumentExpeditionModel   model   = _dataUtil(service, dbContext).GetTestDataVerifiedToCashier_VBRealizationDocumentExpedition();

            int result = await service.VerifiedToCashier(model.VBRealizationId);

            Assert.NotEqual(0, result);
        }
Esempio n. 12
0
        public async Task InitializeExpedition_Return_Success()
        {
            FinanceDbContext dbContext = _dbContext(GetCurrentMethod());
            var serviceProvider        = GetServiceProvider();

            VBRealizationWithPOService vBRealizationWithPOService = new VBRealizationWithPOService(dbContext, serviceProvider.Object);
            var vBRealizationWithPODto = _dataUtil(vBRealizationWithPOService).GetTestData_TanpaNomorVB();

            VBRealizationDocumentExpeditionService service = new VBRealizationDocumentExpeditionService(dbContext, serviceProvider.Object);
            var realizationVbModel = _dataUtil(service, dbContext).GetTestData_RealizationVbs();


            int result = await service.InitializeExpedition(realizationVbModel.Id);

            Assert.NotEqual(0, result);
        }
Esempio n. 13
0
        public async Task CashierReceipt_Return_Success()
        {
            FinanceDbContext        dbContext           = _dbContext(GetCurrentAsyncMethod());
            Mock <IServiceProvider> serviceProviderMock = GetServiceProvider();

            VBRealizationWithPOService vBRealizationWithPOService = new VBRealizationWithPOService(dbContext, serviceProviderMock.Object);
            var vBRealizationWithPODto = _dataUtil(vBRealizationWithPOService).GetTestData_TanpaNomorVB();


            VBRealizationDocumentExpeditionService service = new VBRealizationDocumentExpeditionService(dbContext, GetServiceProvider().Object);
            VBRealizationDocumentExpeditionModel   model   = _dataUtil(service, dbContext).GetTestData_VBRealizationDocumentExpedition();

            var data   = model.VBRealizationId;
            int result = await service.CashierReceipt(new List <int>() { data });

            Assert.NotEqual(0, result);
        }
Esempio n. 14
0
        public async Task ClearanceVBPost_Return_Success()
        {
            FinanceDbContext dbContext = _dbContext(GetCurrentAsyncMethod());

            VBRealizationDocumentExpeditionService service = new VBRealizationDocumentExpeditionService(dbContext, GetServiceProvider().Object);
            VBRequestDocumentModel model = _dataUtil(service, dbContext).GetTestData_VBRequestDocument();

            List <ClearancePostId> postIds = new List <ClearancePostId>();
            ClearancePostId        postId  = new ClearancePostId();

            postId.VBRealizationId = 0;
            postId.VBRequestId     = 1;
            postIds.Add(postId);
            var result = await service.ClearanceVBPost(postIds);

            Assert.NotEqual(0, result);
        }
Esempio n. 15
0
        public async Task Success_Success_ClearanceVBPost()
        {
            var dbContext       = _dbContext(GetCurrentMethod());
            var serviceProvider = GetServiceProvider().Object;
            var service         = new ClearaceVBService(serviceProvider, dbContext);

            var data = await _dataUtil(service).GetTestData();

            var vBRealizationDocumentNonPOService = new VBRealizationDocumentNonPOService(serviceProvider, dbContext);
            var vm = await _dataUtil(vBRealizationDocumentNonPOService).GetTestData();

            var VBRealizationDocumentExpedition = new VBRealizationDocumentExpeditionService(dbContext, GetServiceProvider().Object);
            var model = _dataUtil(VBRealizationDocumentExpedition, dbContext).GetTestData_VBRealizationDocumentExpedition();


            var dto = _dataUtil(service).GetNewData_ClearenceFormDto();

            var Response = await service.ClearanceVBPost(dto);

            Assert.NotEqual(0, Response);
        }
Esempio n. 16
0
        public async Task ClearanceVBPost2_Return_Success()
        {
            FinanceDbContext dbContext = _dbContext(GetCurrentAsyncMethod());

            VBRealizationDocumentExpeditionService service = new VBRealizationDocumentExpeditionService(dbContext, GetServiceProvider().Object);
            VBRequestDocumentModel model = _dataUtil(service, dbContext).GetTestData_VBRequestDocument();

            List <ClearancePostId> postIds = new List <ClearancePostId>();
            ClearancePostId        postId  = new ClearancePostId();

            postId.VBRealizationId = 0;
            postId.VBRequestId     = 1;
            postIds.Add(postId);

            ClearanceFormDto clearanceForm = new ClearanceFormDto();

            clearanceForm.Bank = new Lib.ViewModels.NewIntegrationViewModel.AccountBankViewModel {
                AccountCOA    = "",
                AccountName   = "",
                AccountNumber = "",
                BankCode      = "",
                BankName      = "",
                Code          = "",
                Currency      = new Lib.ViewModels.NewIntegrationViewModel.CurrencyViewModel {
                    Code        = "",
                    Description = "",
                    Id          = 1,
                    Rate        = 1,
                    Symbol      = ""
                },
                Id = 1
            };
            clearanceForm.ListIds = postIds;

            var result = await service.ClearanceVBPost(clearanceForm);

            Assert.NotEqual(0, result);
        }
        public async Task Should_Success_AutoJournalVBNonPOClearence_With_ViewModel()
        {
            //Setup
            var dbContext           = GetDbContext(GetCurrentMethod());
            var serviceProviderMock = GetServiceProvider();

            serviceProviderMock.Setup(s => s.GetService(typeof(FinanceDbContext))).Returns(dbContext);
            serviceProviderMock
            .Setup(x => x.GetService(typeof(IHttpClientService)))
            .Returns(new JournalHttpClientTestService());

            Mock <IJournalTransactionService> journalTransactionServiceMock = new Mock <IJournalTransactionService>();

            serviceProviderMock
            .Setup(x => x.GetService(typeof(IJournalTransactionService)))
            .Returns(journalTransactionServiceMock.Object);

            var masterCOAServiceMock = new MasterCOAService(serviceProviderMock.Object);

            serviceProviderMock
            .Setup(x => x.GetService(typeof(IMasterCOAService)))
            .Returns(masterCOAServiceMock);


            var vBRequestDocumentService = new VBRequestDocumentService(dbContext, GetServiceProvider().Object);
            var data = await GetdataUtil(vBRequestDocumentService).GetTestData_VBRequestDocumentNonPO();

            var vBRealizationWithPOService = new VBRealizationWithPOService(dbContext, serviceProviderMock.Object);
            var vBRealizationDocumenData   = GetDataUtil(vBRealizationWithPOService).GetTestData_DenganNomorVB();

            var expeditionService = new VBRealizationDocumentExpeditionService(dbContext, GetServiceProvider().Object);
            var model             = _dataUtil(expeditionService, dbContext).GetTestData_VBRealizationDocumentExpedition();

            var realization = new Lib.ViewModels.VBRealizationDocumentNonPO.VBRealizationDocumentNonPOViewModel()
            {
                IsInklaring = true,
                Currency    = new Lib.ViewModels.VBRealizationDocumentNonPO.CurrencyViewModel()
                {
                    Code = "IDR"
                }
            };

            var expenditureitem = new Lib.ViewModels.VBRealizationDocumentNonPO.VBRealizationDocumentNonPOExpenditureItemViewModel()
            {
                PPhAmount = 1,
                PPnAmount = 1,
            };

            var unitcostitem = new Lib.ViewModels.VBRealizationDocumentNonPO.VBRealizationDocumentNonPOUnitCostViewModel()
            {
                IsSelected = true
            };

            var vbRealizations          = new VBRealizationDocumentModel(realization);
            var vbRealizationItems      = new VBRealizationDocumentExpenditureItemModel(2, expenditureitem);
            var vbRealizationsUnitItems = new VBRealizationDocumentUnitCostsItemModel(2, unitcostitem);

            dbContext.VBRealizationDocuments.Add(vbRealizations);
            dbContext.VBRealizationDocumentExpenditureItems.Add(vbRealizationItems);
            dbContext.VBRealizationDocumentUnitCostsItems.Add(vbRealizationsUnitItems);
            dbContext.SaveChanges();

            var service = new AutoJournalService(dbContext, serviceProviderMock.Object);

            AccountBankViewModel viewModel = new AccountBankViewModel()
            {
                AccountCOA    = "AccountCOA",
                AccountName   = "AccountName",
                AccountNumber = "AccountNumber",
                BankCode      = "BankCode",
                BankName      = "BankName",
                Code          = "Code",
                Currency      = new CurrencyViewModel()
                {
                    Code        = "Rp",
                    Description = "Description",
                    Rate        = 1,
                    Symbol      = "IDR"
                },
            };

            List <int> vbRealizationIds = new List <int>()
            {
                1,
                2
            };

            //Act
            var result = await service.AutoJournalVBNonPOClearence(vbRealizationIds, viewModel, null);

            //Assert
            Assert.NotEqual(0, result);
        }
Esempio n. 18
0
 private VBRealizationDocumentExpeditionDataUtil _dataUtil(VBRealizationDocumentExpeditionService service, FinanceDbContext financeDbContext)
 {
     return(new VBRealizationDocumentExpeditionDataUtil(service, financeDbContext));
 }
Esempio n. 19
0
 public VBRealizationDocumentExpeditionDataUtil(VBRealizationDocumentExpeditionService service, FinanceDbContext financeDbContext)
 {
     Service   = service;
     dbContext = financeDbContext;
 }
Esempio n. 20
0
        public async Task Should_Success_AutoJournalVBNonPOClearence_With_ViewModel()
        {
            //Setup
            var dbContext           = GetDbContext(GetCurrentMethod());
            var serviceProviderMock = GetServiceProvider();

            serviceProviderMock.Setup(s => s.GetService(typeof(FinanceDbContext))).Returns(dbContext);
            serviceProviderMock
            .Setup(x => x.GetService(typeof(IHttpClientService)))
            .Returns(new JournalHttpClientTestService());

            Mock <IJournalTransactionService> journalTransactionServiceMock = new Mock <IJournalTransactionService>();

            serviceProviderMock
            .Setup(x => x.GetService(typeof(IJournalTransactionService)))
            .Returns(journalTransactionServiceMock.Object);

            var masterCOAServiceMock = new MasterCOAService(serviceProviderMock.Object);

            serviceProviderMock
            .Setup(x => x.GetService(typeof(IMasterCOAService)))
            .Returns(masterCOAServiceMock);


            var vBRequestDocumentService = new VBRequestDocumentService(dbContext, GetServiceProvider().Object);
            var data = await GetdataUtil(vBRequestDocumentService).GetTestData_VBRequestDocumentNonPO();

            var vBRealizationWithPOService = new VBRealizationWithPOService(dbContext, serviceProviderMock.Object);
            var vBRealizationDocumenData   = GetDataUtil(vBRealizationWithPOService).GetTestData_DenganNomorVB();

            var expeditionService = new VBRealizationDocumentExpeditionService(dbContext, GetServiceProvider().Object);
            var model             = _dataUtil(expeditionService, dbContext).GetTestData_VBRealizationDocumentExpedition();

            var service = new AutoJournalService(dbContext, serviceProviderMock.Object);

            AccountBankViewModel viewModel = new AccountBankViewModel()
            {
                AccountCOA    = "AccountCOA",
                AccountName   = "AccountName",
                AccountNumber = "AccountNumber",
                BankCode      = "BankCode",
                BankName      = "BankName",
                Code          = "Code",
                Currency      = new CurrencyViewModel()
                {
                    Code        = "Rp",
                    Description = "Description",
                    Rate        = 1,
                    Symbol      = "IDR"
                },
            };

            List <int> vbRealizationIds = new List <int>()
            {
                1
            };

            //Act
            var result = await service.AutoJournalVBNonPOClearence(vbRealizationIds, viewModel);

            //Assert
            Assert.NotEqual(0, result);
        }