Ejemplo n.º 1
0
        public void BCR_GetRate_SuccessfulCall_ReturnsData()
        {
            BCR unitUnderTest = new BCR();
            var result        = unitUnderTest.getRate();

            Assert.IsTrue(result.Count > 0 && result.Count % 4 == 0, ERR_MESSAGE);
        }
Ejemplo n.º 2
0
        public void BCR_GetRate_getBankInfo_ReturnsSpecificString()
        {
            BCR    unitUnderTest = new BCR();
            string expected      = "name: BCR, market share: 16.2%";
            var    result        = unitUnderTest.getBankInfo();

            Assert.IsTrue(result == expected, ERR_MESSAGE);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Clears the Forms in the Property Form Fields
 /// </summary>
 private void ClearPropertyForm()
 {
     landAcquisitionCost.Clear();
     AcquisitionLeasing.Clear();
     Syndication.Clear();
     LandTransfer.Clear();
     LegalPurchaseLease.Clear();
     Environmental.Clear();
     Contigency.Clear();
     Mortgage.Clear();
     Construction.Clear();
     Appraisal.Clear();
     BCR.Clear();
     MortgageLTV.Clear();
     Interest25.Clear();
     AnnualDebt.Clear();
 }
Ejemplo n.º 4
0
        private void CalcBCR(string[] Fields, IRace race)
        {
            //declares and assigns
            var     dtRaces            = new DataTable();
            var     dtAWRaces          = new DataTable();
            var     iIndex             = 0;
            var     iSurfaceIndex      = 325;
            var     iRaceDateIndex     = 255;
            var     iClassRatingsIndex = 835;
            var     iAWSurfaceIndex    = 1402;
            Decimal dOutVal;

            BCR = (Decimal)0.00;

            dtRaces.Columns.Add(new DataColumn("ClassRating", System.Type.GetType("System.Decimal")));
            dtAWRaces.Columns.Add(new DataColumn("ClassRating", System.Type.GetType("System.Decimal")));

            //process
            while (iIndex < 10)
            {
                dOutVal = (Decimal)0.00;
                var raceDate = race.Date;

                if ((DateTime.TryParseExact(Fields[iRaceDateIndex + iIndex], "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out DateTime horseRaceDate)))
                {
                    var raceDays = (raceDate - horseRaceDate).TotalDays;

                    if (raceDays < 240)
                    {
                        //get all allweather races
                        if (Fields[iAWSurfaceIndex + iIndex].ToLower() == "a" && dtAWRaces.Rows.Count < 4)
                        {
                            dtAWRaces.Rows.Add(dtAWRaces.NewRow());
                            dtAWRaces.Rows[dtAWRaces.Rows.Count - 1][0] = Decimal.TryParse(Fields[iClassRatingsIndex + iIndex], out dOutVal) ? Convert.ToDecimal(Fields[iClassRatingsIndex + iIndex]) : (Decimal)0.00;
                        }

                        //get all races of this track type
                        if ((((Fields[iSurfaceIndex + iIndex].ToLower().Equals(race.Track.TrackTypeShort.ToLower())) ||
                              ((race.Track.AllWeather) && (Fields[iSurfaceIndex + iIndex].ToLower().Equals("t")))) &&
                             (!Fields[iAWSurfaceIndex + iIndex].ToLower().Equals("a"))) &&
                            (dtRaces.Rows.Count < 4))
                        {
                            dtRaces.Rows.Add(dtRaces.NewRow());
                            dtRaces.Rows[dtRaces.Rows.Count - 1][0] = Decimal.TryParse(Fields[iClassRatingsIndex + iIndex], out dOutVal) ? Convert.ToDecimal(Fields[iClassRatingsIndex + iIndex]) : (Decimal)0.00;
                        }
                    }
                    else
                    {
                        iIndex = 10;
                    }
                }

                //increment
                ++iIndex;
            }

            //if track is All Weather, and there are no races in the table to choose from, then use a Turf / Inner Turf race.
            if (race.Track.AllWeather)
            {
                dtRaces.DefaultView.Sort   = "ClassRating desc";
                dtAWRaces.DefaultView.Sort = "ClassRating desc";

                BCR = (dtAWRaces.Rows.Count > 0) ? Convert.ToDecimal(dtAWRaces.DefaultView.ToTable().Rows[0]["ClassRating"].ToString()) : BCR;
                BCR = (BCR.Equals((Decimal)0.00)) && (dtRaces.Rows.Count > 0) ? Convert.ToDecimal(dtRaces.DefaultView.ToTable().Rows[0]["ClassRating"].ToString()) : BCR;
            }
            else
            {
                switch (race.Track.TrackTypeShort.ToLower())
                {
                case "t":
                    dtRaces.DefaultView.Sort   = "ClassRating desc";
                    dtAWRaces.DefaultView.Sort = "ClassRating desc";

                    BCR = (dtRaces.Rows.Count > 0) ? Convert.ToDecimal(dtRaces.DefaultView.ToTable().Rows[0]["ClassRating"].ToString()) : BCR;
                    BCR = (BCR.Equals((Decimal)0.00)) && (dtAWRaces.Rows.Count > 0) ? Convert.ToDecimal(dtAWRaces.DefaultView.ToTable().Rows[0]["ClassRating"].ToString()) : BCR;

                    //if track is Turf / Inner Turf, and there are no races in the table to choose from, then use an All Weather race.
                    break;

                default:     //All others
                    if (dtRaces.Rows.Count > 0)
                    {
                        dtRaces.DefaultView.Sort = "ClassRating desc";
                        BCR = Convert.ToDecimal(dtRaces.DefaultView.ToTable().Rows[0]["ClassRating"].ToString());
                    }
                    break;
                }
            }
        }