Esempio n. 1
0
        public void MaxSpeedMileTest()
        {
            SummaryCalculator sv     = new SummaryCalculator(heart, speed, speed_mile, cadence, altitude, power, powerBalance, time);
            String            result = sv.MaxSpeedMile();

            Assert.AreEqual(result, "Maximum Speed=40 miles/hr");
        }
Esempio n. 2
0
        /// <summary>
        /// Calls the summary calculator class and calculates summary and displays it in text area
        /// </summary>

        public void SummaryFiller()
        {
            SummaryCalculator sv = new SummaryCalculator(heart, speed, speed_mile, cadence, altitude, power, powerbalance, time);
            string            totalDistanceKm = sv.TotalDistance();
            string            totalMile       = sv.TotalDistanceMile();
            string            avgSpeed        = sv.AverageSpeed();
            string            maxSpeed        = sv.MaxSpeed();
            string            avgSpeedMile    = sv.AverageSpeedMile();
            string            maxSpeedMile    = sv.MaxSpeedMile();
            string            avgHeartRate    = sv.AverageHeartRate();
            string            minHeartRate    = sv.MinHeartRate();
            string            maxHeartRate    = sv.MaxHeartRate();
            string            avgPower        = sv.AveragePower();
            string            avgAlt          = sv.AverageAltitude();
            string            maxPower        = sv.maxPower();

            List <string> summary = new List <string>();

            summary.Add(totalMile);
            summary.Add(avgSpeedMile);
            summary.Add(maxSpeedMile);
            summary.Add(avgHeartRate);
            summary.Add(maxHeartRate);
            summary.Add(minHeartRate);
            summary.Add(avgPower);
            summary.Add(maxPower);
            summary.Add(avgAlt);


            foreach (string val in summary)
            {
                txtSummary.Text = txtSummary.Text + val + Environment.NewLine;

                summary2.Text = summary2.Text + val + Environment.NewLine;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// method to fetch the calculations from summary class and fill the text area
        /// </summary>
        /// <param name="unit"></param>
        public void SummaryFiller(String unit)
        {
            SummaryCalculator sv = new SummaryCalculator(heart, speed, speed_mile, cadence, altitude, power, powerbalance, timee);
            string            totalDistanceKm = sv.TotalDistance();
            string            totalMile       = sv.TotalDistanceMile();
            string            avgSpeed        = sv.AverageSpeed();
            string            maxSpeed        = sv.MaxSpeed();
            string            avgSpeedMile    = sv.AverageSpeedMile();
            string            maxSpeedMile    = sv.MaxSpeedMile();
            string            avgHeartRate    = sv.AverageHeartRate();
            string            minHeartRate    = sv.MinHeartRate();
            string            maxHeartRate    = sv.MaxHeartRate();
            string            avgPower        = sv.AveragePower();
            string            avgAlt          = sv.AverageAltitude();
            string            maxPower        = sv.maxPower();


            if (unit.Equals("km/hr"))
            {
                List <string> summary = new List <string>
                {
                    totalDistanceKm,
                    avgSpeed,
                    maxSpeed,
                    avgHeartRate,
                    maxHeartRate,
                    minHeartRate,
                    avgPower,
                    avgAlt,
                    maxPower,
                };

                foreach (string val in summary)
                {
                    txtSummary.Text = txtSummary.Text + val + Environment.NewLine;

                    summary2.Text = summary2.Text + val + Environment.NewLine;
                }
                foreach (string val in summary)
                {
                    summary2.Text = summary2.Text + val + Environment.NewLine;
                }
            }
            else if (unit.Equals("miles/hr"))
            {
                List <string> summary = new List <string>();
                summary.Add(totalMile);
                summary.Add(avgSpeedMile);
                summary.Add(maxSpeedMile);
                summary.Add(avgHeartRate);
                summary.Add(maxHeartRate);
                summary.Add(minHeartRate);
                summary.Add(avgPower);
                summary.Add(maxPower);
                summary.Add(avgAlt);


                foreach (string val in summary)
                {
                    txtSummary.Text = txtSummary.Text + val + Environment.NewLine;

                    summary2.Text = summary2.Text + val + Environment.NewLine;
                }
                foreach (string val in summary)
                {
                    summary2.Text = summary2.Text + val + Environment.NewLine;
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Fills the  Summary details into the table for compariion
        /// </summary>
        public void SummaryFiller()
        {
            SummaryCalculator sv = new SummaryCalculator(heart, speed, speed_mile, cadence, altitude, power, powerbalance, timee);

            string[] stotalDistanceKm = sv.TotalDistance().Split('=');
            String   totalDistanceKm  = stotalDistanceKm[1];

            string[] stotalMile = sv.TotalDistanceMile().Split('=');
            String   totalMile  = stotalMile[1];

            string[] savgSpeed = sv.AverageSpeed().Split('=');
            String   avgSpeed  = savgSpeed[1];

            string[] smaxSpeed = sv.MaxSpeed().Split('=');
            string   maxSpeed  = smaxSpeed[1];

            string[] savgSpeedMile = sv.AverageSpeedMile().Split('=');
            string   avgSpeedMile  = savgSpeedMile[1];

            string[] smaxSpeedMile = sv.MaxSpeedMile().Split('=');
            string   maxSpeedMile  = smaxSpeedMile[1];

            string[] savgHeartRate = sv.AverageHeartRate().Split('=');
            string   avgHeartRate  = savgHeartRate[1];

            string[] sminHeartRate = sv.MinHeartRate().Split('=');
            string   minHeartRate  = sminHeartRate[1];

            string[] smaxHeartRate = sv.MaxHeartRate().Split('=');
            string   maxHeartRate  = smaxHeartRate[1];

            string[] savgPower = sv.AveragePower().Split('=');
            string   avgPower  = savgPower[1];

            string[] savgAlt = sv.AverageAltitude().Split('=');
            string   avgAlt  = savgAlt[1];

            string[] smaxPower = sv.maxPower().Split('=');
            string   maxPower  = smaxPower[1];
            string   ftp       = sv.CalculateFTP();

            string[] norm1 = sv.CalculateNP().Split('=');
            string   Np1   = norm1[1];

            string[] sIF1 = sv.CalculateIF().Split('=');
            string   IF1  = sIF1[1];

            string[] sTss1 = sv.CalculateTSS().Split('=');
            string   Tss1  = sTss1[1];

            dataGridView3.Rows.Add(totalDistanceKm, avgSpeed, maxSpeed, avgHeartRate, maxHeartRate, minHeartRate, avgPower, maxPower, avgAlt, IF1, Tss1, Np1);



            SummaryCalculator sv1 = new SummaryCalculator(heart11, speed11, speed_mile11, cadence11, altitude11, power11, powerbalance11, timee1);

            string[] stotalDistanceKm1 = sv1.TotalDistance().Split('=');
            String   totalDistanceKm1  = stotalDistanceKm[1];

            string[] stotalMile1 = sv1.TotalDistanceMile().Split('=');
            String   totalMile1  = stotalMile1[1];

            string[] savgSpeed1 = sv1.AverageSpeed().Split('=');
            String   avgSpeed1  = savgSpeed1[1];

            string[] smaxSpeed1 = sv1.MaxSpeed().Split('=');
            string   maxSpeed1  = smaxSpeed1[1];

            string[] savgSpeedMile1 = sv1.AverageSpeedMile().Split('=');
            string   avgSpeedMile1  = savgSpeedMile1[1];

            string[] smaxSpeedMile1 = sv1.MaxSpeedMile().Split('=');
            string   maxSpeedMile1  = smaxSpeedMile1[1];

            string[] savgHeartRate1 = sv1.AverageHeartRate().Split('=');
            string   avgHeartRate1  = savgHeartRate1[1];

            string[] sminHeartRate1 = sv1.MinHeartRate().Split('=');
            string   minHeartRate1  = sminHeartRate1[1];

            string[] smaxHeartRate1 = sv1.MaxHeartRate().Split('=');
            string   maxHeartRate1  = smaxHeartRate1[1];

            string[] savgPower1 = sv1.AveragePower().Split('=');
            string   avgPower1  = savgPower1[1];

            string[] savgAlt1 = sv1.AverageAltitude().Split('=');
            string   avgAlt1  = savgAlt1[1];

            string[] smaxPower1 = sv1.maxPower().Split('=');
            string   maxPower1  = smaxPower1[1];
            string   ftp1       = sv1.CalculateFTP();

            string[] norm = sv1.CalculateNP().Split('=');
            Console.WriteLine(sv1.CalculateTSS());
            string Np = norm[1];

            string[] sIF = sv1.CalculateIF().Split('=');
            string   IF  = sIF[1];

            string[] sTss = sv1.CalculateTSS().Split('=');
            string   Tss  = sTss[1];



            dataGridView4.Rows.Add(totalDistanceKm1, avgSpeed1, maxSpeed1, avgHeartRate1, maxHeartRate1, minHeartRate1, avgPower1, maxPower1, avgAlt1, IF, Tss, Np);
        }