コード例 #1
0
        public void Init()
        {
            _efContext                     = new Mock <EFContext>();
            _appSettingsMock               = new Mock <IOptions <AppSettings> >();
            _customDataServiceMock         = new Mock <ICustomObjectDataService>();
            _ledgerMaterialCodeServiceMock = new Mock <IPgLedgerMaterialCodeService>();
            _appSettingsMock.Setup(s => s.Value).Returns(new AppSettings {
                FrontendUrl = FrontEndUrl
            });
            _ledgerMaterialCodeServiceMock.Setup(c => c.GetLedgerMaterialCodes(It.IsAny <Guid>()))
            .ReturnsAsync(new PgLedgerMaterialCodeModel());
            _paymentServiceMock = new Mock <IPgPaymentService>();
            var costExchangeRateServiceMock = new Mock <ICostExchangeRateService>();

            _pgCurrencyService = new PgCurrencyService(_efContext.Object);
            _loggerMock        = new Mock <ILogger>();

            PgPurchaseOrderService = new PgPurchaseOrderService(
                _efContext.Object,
                _appSettingsMock.Object,
                _ledgerMaterialCodeServiceMock.Object,
                _customDataServiceMock.Object,
                _pgCurrencyService,
                _loggerMock.Object,
                _paymentServiceMock.Object,
                costExchangeRateServiceMock.Object
                );

            _customDataServiceMock.Setup(ds => ds.GetCustomData <PgPurchaseOrderResponse>(It.IsAny <Guid>(), CustomObjectDataKeys.PgPurchaseOrderResponse))
            .ReturnsAsync(new PgPurchaseOrderResponse());

            SetupCurrencies();
        }
コード例 #2
0
 public PgCostBuilder(IPgStageBuilder pgStageBuilder,
                      IRuleService ruleService,
                      ICostStageRevisionService costStageRevisionService,
                      IAgencyService agencyService,
                      IProjectService projectService,
                      EFContext efContext,
                      ICostNumberGeneratorService costNumberGeneratorService,
                      IPgCurrencyService currencyService,
                      IPgLedgerMaterialCodeService pgLedgerMaterialCodeService,
                      ICostLineItemService costLineItemService,
                      ICostTemplateVersionService costTemplateVersionService,
                      IPermissionService permissionService,
                      IPgCostService pgCostService,
                      IPgCostSectionTotalsBuilder pgTotalsBuilder,
                      IPgPaymentService pgPaymentService,
                      IExchangeRateService exchangeRateService)
 {
     _pgStageBuilder           = pgStageBuilder;
     _ruleService              = ruleService;
     _costStageRevisionService = costStageRevisionService;
     _agencyService            = agencyService;
     _projectService           = projectService;
     _efContext = efContext;
     _costNumberGeneratorService  = costNumberGeneratorService;
     _currencyService             = currencyService;
     _pgLedgerMaterialCodeService = pgLedgerMaterialCodeService;
     _costLineItemService         = costLineItemService;
     _costTemplateVersionService  = costTemplateVersionService;
     _permissionService           = permissionService;
     _pgCostService       = pgCostService;
     _pgTotalsBuilder     = pgTotalsBuilder;
     _pgPaymentService    = pgPaymentService;
     _exchangeRateService = exchangeRateService;
 }
コード例 #3
0
 public PgPurchaseOrderService(EFContext efContext,
                               IOptions <AppSettings> appSettings,
                               IPgLedgerMaterialCodeService ledgerMaterialCode,
                               ICustomObjectDataService customDataService,
                               IPgCurrencyService pgCurrencyService,
                               ILogger logger,
                               IPgPaymentService pgPaymentService,
                               ICostExchangeRateService costExchangeRateService)
 {
     _efContext               = efContext;
     _ledgerMaterialCode      = ledgerMaterialCode;
     _customDataService       = customDataService;
     _appSettings             = appSettings.Value;
     _currencyService         = pgCurrencyService;
     _logger                  = logger;
     _pgPaymentService        = pgPaymentService;
     _costExchangeRateService = costExchangeRateService;
 }
コード例 #4
0
 public PgPaymentService(
     EFContext efContext,
     ICostStageRevisionService costStageRevisionService,
     IRuleService ruleService,
     IStageService stageService,
     IPgCurrencyService pgCurrencyService,
     IPgCostSectionTotalsBuilder pgTotalsBuilder,
     IPgCostStageRevisionTotalPaymentsBuilder pgTotalPaymentsBuilder,
     ICustomObjectDataService customObjectDataService
     )
 {
     _efContext = efContext;
     _costStageRevisionService = costStageRevisionService;
     _ruleService             = ruleService;
     _stageService            = stageService;
     _pgCurrencyService       = pgCurrencyService;
     _pgTotalsBuilder         = pgTotalsBuilder;
     _pgTotalPaymentsBuilder  = pgTotalPaymentsBuilder;
     _customObjectDataService = customObjectDataService;
 }
コード例 #5
0
        public void Init()
        {
            var ruleEngine   = GetService <IRuleEngine>();
            var efContext    = GetService <EFContext>();
            var ruleBuilders = GetService <IEnumerable <Lazy <IVendorRuleBuilder, PluginMetadata> > >();
            var ruleServices = GetService <IEnumerable <Lazy <IPluginRuleService, PluginMetadata> > >();

            Service = new RuleService(ruleBuilders, ruleServices, ruleEngine, efContext);

            _costStageRevisionServiceMock = new Mock <ICostStageRevisionService>();
            _customDataServiceMock        = new Mock <ICustomObjectDataService>();
            _loggerMock                      = new Mock <ILogger>();
            _currencyService                 = new Mock <ICurrencyService>();
            _costExchangeRateServiceMock     = new Mock <ICostExchangeRateService>();
            _pgLedgerMaterialCodeServiceMock = new Mock <IPgLedgerMaterialCodeService>();
            _appSettingsMock                 = new Mock <IOptions <AppSettings> >();
            _pgCostServiceMock               = new Mock <IPgCostService>();

            _efContext               = EFContextFactory.CreateInMemoryEFContext();
            _pgCurrencyService       = new PgCurrencyService(_efContext);
            _customObjectDataService = new Mock <ICustomObjectDataService>();

            var pgStageBuilder = new PgStageBuilder(Service,
                                                    _efContext,
                                                    _costStageRevisionServiceMock.Object,
                                                    _pgCostServiceMock.Object
                                                    );

            var stageBuilders = new List <Lazy <IStageBuilder, PluginMetadata> >
            {
                new Lazy <IStageBuilder, PluginMetadata>(
                    () => pgStageBuilder,
                    new PluginMetadata {
                    BuType = BuType.Pg
                }
                    )
            };

            var stageService = new StageService(stageBuilders);

            _pgTotalsBuilder        = new PgCostSectionTotalsBuilder();
            _pgTotalPaymentsBuilder = new PgCostStageRevisionTotalPaymentsBuilder();

            var paymentService = new PgPaymentService(
                _efContext,
                _costStageRevisionServiceMock.Object,
                Service,
                stageService,
                _pgCurrencyService,
                _pgTotalsBuilder,
                _pgTotalPaymentsBuilder,
                _customObjectDataService.Object
                );

            _pgPaymentService = paymentService;
            _paymentService   = paymentService;

            _purchaseOrderService = new PgPurchaseOrderService(
                _efContext,
                _appSettingsMock.Object,
                _pgLedgerMaterialCodeServiceMock.Object,
                _customDataServiceMock.Object,
                _pgCurrencyService,
                _loggerMock.Object,
                _pgPaymentService,
                _costExchangeRateServiceMock.Object);
        }