public void SetUp()
 {
     _dishFactory = CreateMock<IDishFactory>();
     _referenceData = new ReferenceData(_dishFactory.Object);
     _tempPath = Path.GetTempFileName();
     File.WriteAllText(_tempPath, DishData);
 }
示例#2
0
        private void InitMine()
        {
            _referenceData = new ReferenceDataMicrosoftAccess(_settingDatabaseConnection, _settingProvider);

            _zelioPlc = new Plc(Settings);
            _zelioPlc.PlcDataUpdated       += ZelioPlcOnPlcDataUpdated;
            _zelioPlc.SensorLabelChanged   += ZelioPlcOnSensorLabelChanged;
            _zelioPlc.SensorProductChanged += ZelioPlcOnSensorProductChanged;
            _zelioPlc.SensorRejectChanged  += ZelioPlcOnSensorRejectChanged;


            _barcodeEntry = new BarcodeEntry();
            _barcodeEntry.BarcodeDataUpdated  += BarcodeEntryOnBarcodeDataUpdated;
            _barcodeEntry.BarcodeStateChanged += BarcodeEntryOnBarcodeStateChanged;



            if (Settings.UseSerialBarcode)
            {
                _serialBarcodeReader = new SerialBarcodeReader(Settings.ArticleNumberLength);
                _serialBarcodeReader.BarcodeDataUpdated += SerialBarcodeReaderOnBarcodeDataUpdated;
            }

            try
            {
                PackingStateChanged -= OnPackingStateChanged;
            }
            finally
            {
                PackingStateChanged += OnPackingStateChanged;
            }
            SetPackingState(PackingStates.WakingUp);
        }
 public void SetUp()
 {
     _dishFactory   = CreateMock <IDishFactory>();
     _referenceData = new ReferenceData(_dishFactory.Object);
     _tempPath      = Path.GetTempFileName();
     File.WriteAllText(_tempPath, DishData);
 }
示例#4
0
        public static IEnumerable <ReferenceData> GetItemsByCode(this IReferenceData source, string code)
        {
            var data   = source.GetItems();
            var result = data.Where(d => d.Code == code);

            return(result);
        }
 public DD04IsInRangeRule(ISharedRule <List <LearningDelivery>, List <DD04Result> > dd04Rule,
                          IReferenceData <string, string> referenceData, IDateHelper dateHelper)
 {
     _dd04Rule      = dd04Rule;
     _ReferenceData = referenceData;
     _dateHelper    = dateHelper;
 }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <MealTypeModel> > GetMealTypesAsync(this IReferenceData operations, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetMealTypesWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
示例#7
0
        /// <summary>
        /// Gets a single reference data entry by ID
        /// </summary>
        /// <typeparam name="T">The system type of the data</typeparam>
        /// <param name="id">The "ID" of the reference data entry</param>
        /// <returns>One data entry, if it matches</returns>
        public static T GetOne <T>(long id) where T : IReferenceData
        {
            IReferenceData returnValue = default(T);
            var            parms       = new Dictionary <string, object>();

            parms.Add("id", id);

            try
            {
                var baseType = GetDataTableName(typeof(T));
                var sql      = string.Format("select * from [dbo].[{0}] where ID = @id", baseType.Name);
                var ds       = SqlWrapper.RunDataset(sql, CommandType.Text, parms);

                if (ds.Rows != null)
                {
                    foreach (DataRow dr in ds.Rows)
                    {
                        returnValue = Activator.CreateInstance(baseType) as IReferenceData;
                        returnValue.Fill(dr);
                    }
                }
            }
            catch (Exception ex)
            {
                LoggingUtility.LogError(ex);
            }

            return((T)returnValue);
        }
示例#8
0
 public LearnerStartDateRuleValidator(IValidationErrorHandler <MessageLearner> validationErrorHandler,
                                      IDD07Rule dd07IsYRule,
                                      IReferenceData <string, string> referenceData)
 {
     _validationErrorHandler = validationErrorHandler;
     _referenceData          = referenceData;
     _dd07IsYRule            = dd07IsYRule;
 }
示例#9
0
 public HomeController()
 {
     _firmsData           = new FirmsData();
     _referenceData       = new ReferenceData();
     _customerWritingData = new CustomerWritingData();
     _newsData            = new NewsData();
     _popupData           = new PopupData();
 }
示例#10
0
        //public BaseLearningDeliveryStartDateRule()
        //{

        //}
        public BaseLearningDeliveryStartDateRule(IValidationErrorHandler <MessageLearner> validationErrorHandler,
                                                 IDD07Rule dd07IsYRule,
                                                 IReferenceData <string, string> referenceData)
        {
            ValidationErrorHandler = validationErrorHandler;
            ReferenceData          = referenceData;
            Dd07IsYRule            = dd07IsYRule;
        }
示例#11
0
 public DD21GetLearningDeliveriesWithSpecificEmpStatusMonitoringType(IReferenceData <string, string> referenceData)
 {
     _allowedEmpStats     = referenceData.Get(AppConstants.DD21AllowedEmpStats).Split(',').ToList();
     _allowedEsmTypePart1 = referenceData.Get(AppConstants.DD21EmpTypePart1);
     _allowedEsmCodePart1 = referenceData.Get(AppConstants.DD21EmpCodePart1);
     _allowedEsmTypePart2 = referenceData.Get(AppConstants.DD21EmpTypePart2);
     _allowedEsmCodePart2 = referenceData.Get(AppConstants.DD21EmpCodePart2);
 }
示例#12
0
 /// <summary>
 /// ctor - the reference data is injected so these values acan be changed
 /// without needing to modify the code
 /// </summary>
 /// <param name="referenceData"></param>
 public PremiumCalculator(IReferenceData referenceData)
 {
     _referenceData          = referenceData;
     _referenceData.AgeRisks = _referenceData.AgeRisks.OrderBy(x => x.MaxAge);
     foreach (var ageRisk in _referenceData.AgeRisks)
     {
         ageRisk.SumAssuredRisk = ageRisk.SumAssuredRisk.OrderBy(x => x.Key);
     }
 }
 public DD21Rule(IShortRule <DD28SubModel, LearnerEmploymentStatus> dd28PickMatchingEmpRecord,
                 IDD21GetLearningDeliveriesWithSpecificEmpStatusMonitoringType dd21GetLearningDeliveriesWithSpecificEmp,
                 IReferenceData <string, string> referenceData)
 {
     _dd28PickMatchingEmpRecord = dd28PickMatchingEmpRecord;
     _dd21GetLearningDeliveriesWithSpecificEmp = dd21GetLearningDeliveriesWithSpecificEmp;
     _allowedFamType     = referenceData.Get(AppConstants.DD21AllowedFamType);
     _FamCodeShouldNotBe = referenceData.Get(AppConstants.DD21FamCodeShouldNotBe);
 }
        public DD28Criteria3(IReferenceData <string, string> referenceData)
        {
            _allowedEmpStats      = referenceData.Get(AppConstants.DD28Criteria3EMPStats).Split(',');
            _allowedESMtypePart1  = referenceData.Get(AppConstants.DD28Criteria3ESMTypePart1);
            _allowedESMCodesPart1 = referenceData.Get(AppConstants.DD28Criteria3ESMCodesPart1).Split(',');

            _allowedESMTypePart2  = referenceData.Get(AppConstants.DD28Criteria3ESMTypePart2);
            _allowedESMCodesPart2 = referenceData.Get(AppConstants.DD28Criteria3ESMCodesPart2).Split(',');
        }
示例#15
0
        public void TestSetup()
        {
            //create mock refernce data object
            var referenceData = new Mock <IReferenceData>();

            referenceData.Setup(x => x.MinAge).Returns(18);
            referenceData.Setup(x => x.MaxAge).Returns(65);
            referenceData.Setup(x => x.MinSum).Returns(25000);
            referenceData.Setup(x => x.MaxSum).Returns(500000);
            referenceData.Setup(x => x.CommissionPercent).Returns(3);
            referenceData.Setup(x => x.InitialCommissionPercent).Returns(205);

            var list = new List <AgeRisk>
            {
                new AgeRisk()
                {
                    MaxAge         = 30,
                    SumAssuredRisk = new List <KeyValuePair <int, decimal> >
                    {
                        new KeyValuePair <int, decimal>(25000, .0172M),
                        new KeyValuePair <int, decimal>(50000, .0165M),
                        new KeyValuePair <int, decimal>(100000, .0154M),
                        new KeyValuePair <int, decimal>(200000, .0147M),
                        new KeyValuePair <int, decimal>(300000, .0144M),
                        new KeyValuePair <int, decimal>(500000, .0146M)
                    }
                },
                new AgeRisk()
                {
                    MaxAge         = 50,
                    SumAssuredRisk = new List <KeyValuePair <int, decimal> >
                    {
                        new KeyValuePair <int, decimal>(25000, .1043M),
                        new KeyValuePair <int, decimal>(50000, .0999M),
                        new KeyValuePair <int, decimal>(100000, .0932M),
                        new KeyValuePair <int, decimal>(200000, .0887M),
                        new KeyValuePair <int, decimal>(300000, .0872M)
                    }
                },
                new AgeRisk()
                {
                    MaxAge         = 65,
                    SumAssuredRisk = new List <KeyValuePair <int, decimal> >
                    {
                        new KeyValuePair <int, decimal>(25000, .2677M),
                        new KeyValuePair <int, decimal>(50000, .2565M),
                        new KeyValuePair <int, decimal>(100000, .2393M),
                        new KeyValuePair <int, decimal>(200000, .2285M)
                    }
                }
            };

            referenceData.Setup(x => x.AgeRisks).Returns(list);

            _referenceData = referenceData.Object;
        }
        public BaseTests()
        {
            var services = new ServiceCollection();

            services.AddEntityFramework();
            services.AddReferenceData().AddInMemory();

            _serviceProvider = services.BuildServiceProvider();
            _dbContext       = _serviceProvider.GetRequiredService <ContentStaticDataDbContext>();
            _referenceData   = _serviceProvider.GetRequiredService <IReferenceData>();
        }
        public void GetAllItemsByCode_Get2PerSource()
        {
            // Arrange
            var source = new IReferenceData[] { new ApiReferenceDataSource(), new SqlReferenceDataSource(), new XmlReferenceDataSource() };

            // Act
            var actualCount = source.GetAllItemsByCode("xyz").Count();

            // Assert
            Assert.Equal(6, actualCount);
        }
        public void GetItemsByCode_Get2PerSource()
        {
            // Arrange
            IReferenceData[] data = new IReferenceData[]
            {
                new ApiReferenceDataSource(),
                new SqlReferenceDataSource(),
                new XmlReferenceDataSource()
            };

            // Act
            var actualCount = data.GetAllItemsByCode("xyz").ToList().Count;

            // Assert
            Assert.Equal(6, actualCount);
        }
示例#19
0
        private bool LoadReference(string reference)
        {
            _referenceData = new ReferenceDataMicrosoftAccess(Settings.DatabaseReference, Settings.ProviderDataBase);
            try
            {
                _referenceData.ReferenceDataIsLoaded   -= ReferenceDataOnReferenceDataIsLoaded;
                _referenceData.ReferenceDataIsUnloaded -= ReferenceDataOnReferenceDataIsUnloaded;
            }
            finally
            {
                _referenceData.ReferenceDataIsLoaded   += ReferenceDataOnReferenceDataIsLoaded;
                _referenceData.ReferenceDataIsUnloaded += ReferenceDataOnReferenceDataIsUnloaded;
            }

            var j = _referenceData.LoadByReferenceName(reference);

            return(j);
        }
        public MarketDataViewModel(IPricePublisher pricePublisher, IPriceSource priceSource, IReferenceData referenceData)
        {
            _dispatcher     = Dispatcher.CurrentDispatcher;
            _pricePublisher = pricePublisher;
            _priceSource    = priceSource;
            _referenceData  = referenceData;

            Filter = FilterRow;

            RefreshPricesCmd = new DelegateCommand((object param) => RefreshPrices());
            LivePricesCmd    = new DelegateCommand((object param) => ConfigureLivePriceUpdates());

            foreach (var security in _referenceData.GetSecurities())
            {
                _securityPrices.Add(new SecurityDataViewModel(security));
            }

            RefreshPrices();
        }
示例#21
0
 public FetchSpecificFundModelsLDsWithLearnStartDate(IReferenceData <string, string> referenceData)
 {
     _apprencticeProgAllowedStartDate = Convert.ToDateTime(referenceData.Get("ApprencticeProgAllowedStartDate"));
 }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static IList <ProductCategoryModel> GetProductCategories(this IReferenceData operations)
 {
     return(Task.Factory.StartNew(s => ((IReferenceData)s).GetProductCategoriesAsync(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 public DD29Rule(ILARSCategoryRefData larsExternalData, IReferenceData <string, string> referenceData)
 {
     _larsExternalData = larsExternalData;
     _referenceData    = referenceData;
 }
示例#24
0
 public TempDatabase(IReferenceData referenceData, IDatabaseServer databaseManager)
 {
     ReferenceData   = referenceData;
     DatabaseManager = databaseManager;
 }
示例#25
0
 public DD28RuleCriteria2(IReferenceData <string, string> referenceData)
 {
     _allowedEmpStats = referenceData.Get(AppConstants.DD28Criteria2LearnerEmplStatusEmpStats).Split(',');
     _allowedESMtype  = referenceData.Get(AppConstants.DD28Criteria2EmpStatusMonitoringESMType);
     _allowedESMCodes = referenceData.Get(AppConstants.DD28Criteria2EmpStatusMonitoringESMCodes).Split(',');
 }
 public ReferenceController()
 {
     _referenceData = new ReferenceData();
 }
示例#27
0
 public DD29Rule(IExternalData <string, List <string> > larsExternalData, IReferenceData <string, string> referenceData)
 {
     _larsExternalData = larsExternalData;
     _referenceData    = referenceData;
 }
示例#28
0
 public RotlLearnerDelFamRule(IReferenceData <string, string> referenceData)
 {
     _allowedRotlFamType = referenceData.Get(AppConstants.LearnDelFam66RotlFamType);
     _allowedRotlFamCode = referenceData.Get(AppConstants.LearnDelFam66RotlFamCode);
 }
示例#29
0
 public Waiter(IReferenceData referenceData, IOrderFactory orderFactory)
 {
     _referenceData = referenceData;
     _referenceData.Load("ReferenceData.xml");
     _orderFactory = orderFactory;
 }
示例#30
0
 public Waiter(IReferenceData referenceData, IOrderFactory orderFactory)
 {
     _referenceData = referenceData;
     _referenceData.Load("ReferenceData.xml");
     _orderFactory = orderFactory;
 }
示例#31
0
 public DD28Criteria1(IReferenceData <string, string> referenceData)
 {
     _allowedEmpStats = referenceData.Get(AppConstants.DD28Criteria1EMPStats).Split(',');
     _allowedESMtype  = referenceData.Get(AppConstants.DD28Criteria1EMPType);
     _allowedESMCodes = referenceData.Get(AppConstants.DD28Criteria1ESMCodes).Split(',');
 }
 public LearnStartDate03Rule(IValidationErrorHandler <MessageLearner> validationErrorHandler,
                             IDD07Rule dd07IsYRule,
                             IReferenceData <string, string> referenceData) : base(validationErrorHandler, dd07IsYRule, referenceData)
 {
 }