示例#1
0
        [TestCase(1, 1, -10, 0, 0, true)] //Can enter negative pass yards
        public void CanEnterValidStatsTests(decimal passesAttempted, decimal passesCompleted, decimal passingYards, decimal touchdownPasses, decimal interceptions, bool validInput)
        {
            QBRRequest request = new QBRRequest()
            {
                PassesAttempted = passesAttempted,
                PassesCompleted = passesCompleted,
                PassingYards    = passingYards,
                Interceptions   = interceptions,
                TouchdownPasses = touchdownPasses
            };
            QBRResponse response = QBRCalculations.CalculateQBR(request);

            Assert.AreEqual(validInput, response.ValidInput);
        }
示例#2
0
        public void QBRCalculationTest(string name, decimal passesAttempted, decimal passesCompleted, decimal passingYards, decimal touchdownPasses, decimal interceptions, decimal expectedQBR)
        {
            QBRRequest request = new QBRRequest()
            {
                Name            = name,
                PassesAttempted = passesAttempted,
                PassesCompleted = passesCompleted,
                PassingYards    = passingYards,
                Interceptions   = interceptions,
                TouchdownPasses = touchdownPasses
            };
            QBRResponse response = QBRCalculations.CalculateQBR(request);

            Assert.AreEqual(expectedQBR, response.Rating);
        }
 private void DisplayRating(QBRResponse response)
 {
     if (!response.ValidInput)
     {
         Console.Write("Input Error: ");
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine($"{response.Message}");
         Console.ResetColor();
     }
     else
     {
         Console.WriteLine("Results:");
         Console.WriteLine("---------------------------------");
         Console.WriteLine($"{response.Message}");
         Console.WriteLine("---------------------------------");
     }
 }
 public void Start()
 {
     Greet();
     while (true)
     {
         QBRRequest  request  = TakeInStats();
         QBRResponse response = QBRCalculations.CalculateQBR(request);
         DisplayRating(response);
         bool nextRating = CalculateAnotherRating();
         if (!nextRating)
         {
             break;
         }
         Console.Clear();
     }
     Console.WriteLine("Press any key to quit...");
     Console.ReadKey();
 }