public async Task Should_Success_Create_Data()
        {
            //Arrange
            var dbContext           = GetDbContext(GetCurrentMethod());
            var serviceProviderMock = GetServiceProvider();

            var IVBRealizationDocumentExpeditionServiceMock = new Mock <IVBRealizationDocumentExpeditionService>();

            IVBRealizationDocumentExpeditionServiceMock.Setup(s => s.InitializeExpedition(It.IsAny <int>())).ReturnsAsync(1);

            serviceProviderMock.Setup(serviceProvider => serviceProvider.GetService(typeof(IVBRealizationDocumentExpeditionService))).Returns(IVBRealizationDocumentExpeditionServiceMock.Object);
            serviceProviderMock.Setup(serviceProvider => serviceProvider.GetService(typeof(IHttpClientService))).Returns(new HttpClientOthersExpenditureServiceHelper());

            RealizationVbWithPOService service = new RealizationVbWithPOService(dbContext, serviceProviderMock.Object);
            RealizationVbModel         model   = _dataUtil(service).GetNewData();

            var dataRequestVb = _dataUtil(service).GetDataRequestVB();
            RealizationVbWithPOViewModel viewModel = _dataUtil(service).GetNewViewModel();

            //Act
            var Response = await service.CreateAsync(model, viewModel);

            //Assert
            Assert.NotEqual(0, Response);
        }
        public async Task Should_Success_GenerateExcel()
        {
            VBStatusReportService service = new VBStatusReportService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data = await _dataUtil(service).GetTestData_ById();

            var dataRealisation = new RealizationVbModel()
            {
                DateEstimate    = DateTimeOffset.Now,
                VBNoRealize     = "VBNoRealize",
                VBNo            = "VBNo",
                Date            = DateTimeOffset.Now,
                Amount          = 100,
                isVerified      = false,
                LastModifiedUtc = DateTime.Now,
            };

            service._DbContext.RealizationVbs.Add(dataRealisation);
            service._DbContext.SaveChanges();

            var Response = service.GenerateExcel(0, 0, null, "Clearance", null, null, null, null, null, null, 7);

            Assert.NotNull(Response);
            Response = service.GenerateExcel(0, 0, null, "Outstanding", null, null, null, null, null, null, 7);
            Assert.NotNull(Response);
            Response = service.GenerateExcel(0, 0, null, "All", null, null, null, null, null, null, 7);
            Assert.NotNull(Response);
        }
Beispiel #3
0
        public async Task Should_Success_GenerateExcel()
        {
            VBExpeditionRealizationReportService service = new VBExpeditionRealizationReportService(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data = await _dataUtil(service).GetTestData_ById();

            var dataRealization = new RealizationVbModel()
            {
                VBNo               = "VBNo",
                VBNoRealize        = "VBNoRealize",
                CurrencyCode       = "IDR",
                Amount             = 100,
                Date               = DateTimeOffset.Now,
                VerifiedName       = "VerifiedName",
                VerifiedDate       = DateTimeOffset.Now,
                isVerified         = true,
                isNotVeridied      = false,
                Reason_NotVerified = "Reason_NotVerified",
                LastModifiedUtc    = DateTime.Now,
                Position           = 5
            };

            service._DbContext.RealizationVbs.Add(dataRealization);
            service._DbContext.SaveChanges();

            var Response = service.GenerateExcel(0, 0, null, 0, 0, "All", null, null, 7);

            Assert.NotNull(Response);

            Response = service.GenerateExcel(0, 0, null, 0, 0, "Cashier", data.Date, null, 7);
            Assert.NotNull(Response);

            Response = service.GenerateExcel(0, 0, null, 0, 0, "Return", null, data.Date, 7);
            Assert.NotNull(Response);
        }
        public async Task Read_Return_Success()
        {
            //Arrange
            var dbContext           = GetDbContext(GetCurrentMethod());
            var serviceProviderMock = GetServiceProvider();

            var IVBRealizationDocumentExpeditionServiceMock = new Mock <IVBRealizationDocumentExpeditionService>();

            serviceProviderMock.Setup(serviceProvider => serviceProvider.GetService(typeof(IVBRealizationDocumentExpeditionService))).Returns(IVBRealizationDocumentExpeditionServiceMock.Object);
            serviceProviderMock.Setup(serviceProvider => serviceProvider.GetService(typeof(IHttpClientService))).Returns(new HttpClientOthersExpenditureServiceHelper());

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

            RealizationVbModel model = _dataUtil(service).GetNewData();


            RealizationVbWithPOViewModel viewModel = _dataUtil(service).GetNewViewModel();
            await service.CreateAsync(model, viewModel);

            //Act
            var response = service.Read(1, 1, "{}", new List <string>(), "", "{}");

            //Assert
            Assert.NotNull(response);
        }
        public void Should_Success_Map_RealizationVBWithPO()
        {
            var mapper = new MapperConfiguration(configuration => configuration.AddProfile <RealizationVBWithPOProfile>()).CreateMapper();
            var model  = new RealizationVbModel();
            var vm     = mapper.Map <RealizationVbWithPOViewModel>(model);

            Assert.NotNull(vm);
        }
        public async Task <RealizationVbModel> GetTestData_RealizationVbModel()
        {
            RealizationVbModel data = GetNewData_RealizationVbModel();

            _dbContext.RealizationVbs.Add(data);
            await _dbContext.SaveChangesAsync();

            return(data);
        }
        public async Task ReadToVerified_Success()
        {
            //Setup
            var dbContext             = GetDbContext(GetCurrentMethod());
            var serviceProviderMock   = GetServiceProvider();
            var vbVerificationService = new VbVerificationService(dbContext, serviceProviderMock.Object);

            RealizationVbModel data = await _vbVerificationDataUtil(vbVerificationService, dbContext).GetTestData_RealizationVbModel();

            //Act
            var result = vbVerificationService.ReadToVerified(1, 25, "{}", new List <string>(), "", "{}");

            //Assert
            Assert.NotNull(result);
        }
        public async Task Should_Success_ReadById()
        {
            //Setup
            var dbContext           = GetDbContext(GetCurrentMethod());
            var serviceProviderMock = GetServiceProvider();

            var vbVerificationService = new VbVerificationService(dbContext, serviceProviderMock.Object);
            RealizationVbModel data   = await _vbVerificationDataUtil(vbVerificationService, dbContext).GetTestData_RealizationVbModel();

            //Act
            var result = await vbVerificationService.ReadById(data.Id);

            //Assert
            Assert.NotNull(result);
        }
        public async Task Should_Success_CreateAsync_with_DataNotVerified()
        {
            //Setup
            var dbContext = GetDbContext(GetCurrentAsyncMethod());

            VbVerificationService vbVerificationService = new VbVerificationService(dbContext, GetServiceProvider().Object);

            VbVerificationViewModel viewModel = _vbVerificationDataUtil(vbVerificationService, dbContext).Get_NotVerified_VbVerificationViewModel();
            RealizationVbModel      data      = await _vbVerificationDataUtil(vbVerificationService, dbContext).GetTestData_RealizationVbModel();

            //Act
            var Response = await vbVerificationService.CreateAsync(viewModel);

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

            var vbVerificationService = new VbVerificationService(dbContext, serviceProviderMock.Object);

            RealizationVbModel data = await _vbVerificationDataUtil(vbVerificationService, dbContext).GetTestData_RealizationVbModel();

            //Act
            var response = vbVerificationService.ReadVerification(1, 1, "{}", new List <string>(), "", "{}");

            //Assert
            Assert.NotNull(response);
            Assert.True(response.Data.Count > 0);
        }
Beispiel #11
0
 public void UpdateVBRealizationInfo(RealizationVbModel realizationVB)
 {
     VBRealizationId     = realizationVB.Id;
     VBId                = realizationVB.VBId;
     VBNo                = realizationVB.VBNo;
     VBRealizationNo     = realizationVB.VBNoRealize;
     VBRealizationDate   = realizationVB.Date;
     VBRequestName       = realizationVB.RequestVbName;
     UnitId              = realizationVB.UnitId;
     UnitName            = realizationVB.UnitName;
     DivisionId          = realizationVB.DivisionId;
     DivisionName        = realizationVB.DivisionName;
     VBAmount            = realizationVB.Amount_VB;
     VBRealizationAmount = realizationVB.Amount;
     CurrencyCode        = realizationVB.CurrencyCode;
     CurrencyRate        = (double)realizationVB.CurrencyRate;
 }
        public async Task Should_Success_Create_Data_Mapping()
        {
            var dbContext           = GetDbContext(GetCurrentMethod());
            var serviceProviderMock = GetServiceProvider();
            var IVBRealizationDocumentExpeditionServiceMock = new Mock <IVBRealizationDocumentExpeditionService>();

            serviceProviderMock.Setup(serviceProvider => serviceProvider.GetService(typeof(IVBRealizationDocumentExpeditionService))).Returns(IVBRealizationDocumentExpeditionServiceMock.Object);
            serviceProviderMock.Setup(serviceProvider => serviceProvider.GetService(typeof(IHttpClientService))).Returns(new HttpClientOthersExpenditureServiceHelper());
            RealizationVbWithPOService service = new RealizationVbWithPOService(dbContext, serviceProviderMock.Object);
            RealizationVbModel         model   = _dataUtil(service).GetNewData();

            RealizationVbWithPOViewModel viewModel = _dataUtil(service).GetNewViewModel();
            await service.CreateAsync(model, viewModel);

            var Response = await service.MappingData(viewModel);

            Assert.NotEqual(0, Response);
        }
        public async Task ReadByIdAsync2_Return_Success()
        {
            var dbContext           = GetDbContext(GetCurrentMethod());
            var serviceProviderMock = GetServiceProvider();

            serviceProviderMock.Setup(serviceProvider => serviceProvider.GetService(typeof(IVBRealizationDocumentExpeditionService))).Returns(new RealizationVbWithPOServiceHelper());
            serviceProviderMock.Setup(serviceProvider => serviceProvider.GetService(typeof(IHttpClientService))).Returns(new HttpClientOthersExpenditureServiceHelper());
            RealizationVbWithPOService service = new RealizationVbWithPOService(dbContext, serviceProviderMock.Object);
            RealizationVbModel         model   = _dataUtil(service).GetNewData();

            var dataRequestVb = _dataUtil(service).GetDataRequestVB();

            dbContext.VbRequests.Add(dataRequestVb);
            dbContext.SaveChanges();

            RealizationVbWithPOViewModel viewModel = _dataUtil(service).GetNewViewModel();
            await service.CreateAsync(model, viewModel);

            var response = await service.ReadByIdAsync2(model.Id);

            Assert.NotNull(response);
        }
Beispiel #14
0
        public RealizationVbModel GetTestData_RealizationVbs()
        {
            var data = new RealizationVbModel()
            {
                DivisionId          = 1,
                DivisionName        = "DivisionName",
                CurrencyCode        = "IDR",
                CurrencyRate        = 1,
                Amount              = 1,
                AmountNonPO         = 1,
                Amount_VB           = 1,
                CloseDate           = DateTimeOffset.Now,
                DateEstimate        = DateTimeOffset.Now,
                DateVB              = DateTimeOffset.Now,
                RealizationVbDetail = new List <RealizationVbDetailModel>()
                {
                    new RealizationVbDetailModel()
                    {
                        Remark         = "Remark",
                        AmountNonPO    = 1,
                        CodeProductSPB = "CodeProductSPB",
                        CurrencyCode   = "IDR",
                        CurrencyRate   = 1,
                        CurrencySymbol = "RP",
                        CurrencyId     = "1",
                        DateNonPO      = DateTimeOffset.Now,
                        DateSPB        = DateTimeOffset.Now,
                        DivisionSPB    = "DivisionSPB"
                    }
                },
                Position = 1
            };

            dbContext.RealizationVbs.Add(data);
            dbContext.SaveChanges();
            return(data);
        }