Beispiel #1
0
        public async Task Should_Success_AutoJournalInklaring_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 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.AutoJournalInklaring(vbRealizationIds, viewModel);

            //Assert
            Assert.NotEqual(0, result);
        }
Beispiel #2
0
        public async Task Should_Success_AutoJournalInklaring()
        {
            //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 service = new AutoJournalService(dbContext, serviceProviderMock.Object);

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

            //Act
            var result = await service.AutoJournalInklaring(vbRealizationIds);

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