Esempio n. 1
0
    public void Mix()
    {
        var vm = new DigitModel {
            Password = "******"
        };

        var validations = vm.Validate(vm.Password, _password);

        validations.Print(_output);

        Assert.Empty(validations);
    }
Esempio n. 2
0
    public void Alphabet()
    {
        var vm = new DigitModel {
            Password = "******"
        };

        var validations = vm.Validate(vm.Password, _password);

        validations.Print(_output);

        Assert.Collection(validations, v => v.ErrorMessage = "Digit is required");
    }
Esempio n. 3
0
    public void Numeric()
    {
        var vm = new DigitModel {
            Password = "******"
        };

        var validations = vm.Validate(vm.Password, _password);

        validations.Print(_output);

        //Assert.Collection(validations, v=>v.ErrorMessage = "Digit is required");
        Assert.Empty(validations);
    }
        public void Process(long StartDate, long EndDate)
        {
            bool       IsFinancial   = false;
            decimal    Ratio         = new decimal();
            decimal    TotalAssets   = new decimal();
            decimal    AverageMcap   = new decimal();
            decimal    Maximum       = new decimal();
            decimal    IndicatorVale = new decimal();
            int        NumberOfDays  = new int();
            DigitModel _numRecord    = new DigitModel();

            IsFinancial = _service.GetCompanyType();

            // check if company is Financial or not
            if (IsFinancial)
            {
                Ratio = _service.GetOperatingIncome(StartDate, EndDate);
            }
            else
            {
                Ratio = _service.GetCreditFlow(StartDate, EndDate);
            }

            //calculate total assets
            TotalAssets = _service.GetTotalAssets(StartDate, EndDate);

            //calculate the Mcap avg for last n days
            AverageMcap = _service.GetMcapAverage(StartDate, EndDate, NumberOfDays);

            // find the max number
            Maximum = Math.Max(TotalAssets, AverageMcap);

            //run the equation ration / Max(Total Assets,Average Mcap of last n days)
            IndicatorVale = Ratio / Maximum;

            _numRecord.ItemValue = IndicatorVale;
            _numRecord.ItemCode  = 900;

            //today's date parsed to "yyyyMMdd" formate
            var TodayDate = DateTime.Now.ToString("yyyyMMdd");

            _numRecord.AcquireDate = long.Parse(TodayDate);;

            using (var _DB = new DBEntity())
            {
                _DB.Digits.Add(_numRecord);
                _DB.SaveChanges();
            }
        }