Exemple #1
0
        public void NFLPassRating_NotQuitePerfect_LessThanBestScore()
        {
            //arrange
            var calculator = new PassingCalculator(1000, 774, 12500, 150, 0);

            //act
            var result = calculator.NFLPassRating();

            //assert
            Assert.IsTrue(158.3 > result);
        }
Exemple #2
0
        public void NFLPassRating_BetterThanPerfect_BestScore()
        {
            //arrange
            var calculator = new PassingCalculator(1000, 875, 12500, 150, 0);

            //act
            var result = calculator.NFLPassRating();

            //assert
            Assert.IsTrue(158.3 <= result && 158.4 > result);
        }
Exemple #3
0
        public void NFLPassRating_MoreThanWorstEnough_WorstScore()
        {
            //arrange
            var calculator = new PassingCalculator(1000, 299, 2999, 0, 96);

            //act
            var result = calculator.NFLPassRating();

            //assert
            Assert.AreEqual(0, result);
        }
Exemple #4
0
        public void NFLPassRating_JustWorstEnough_WorstScore()
        {
            //arrange
            var calculator = new PassingCalculator(1000, 300, 3000, 0, 95);

            //act
            var result = calculator.NFLPassRating();

            //assert
            Assert.AreEqual(0, result);
        }
Exemple #5
0
        public void NFLPassRating_NotQuiteWorst_BetterThanWorstScore()
        {
            //arrange
            var calculator = new PassingCalculator(1000, 301, 3001, 0, 94);

            //act
            var result = calculator.NFLPassRating();

            //assert
            Assert.IsTrue(0 < result);
        }
Exemple #6
0
        private void UpdateFormulaRelated()
        {
            _resetCommand.RaiseCanExecuteChanged();

            if (ThrowAttempts.HasValue && PassCompletion.HasValue && PassingYards.HasValue && Touchdowns.HasValue && Interceptions.HasValue)
            {
                _calculator.ThrowAttempts  = ThrowAttempts.Value;
                _calculator.PassCompletion = PassCompletion.Value;
                _calculator.PassingYards   = PassingYards.Value;
                _calculator.Touchdowns     = Touchdowns.Value;
                _calculator.Interceptions  = Interceptions.Value;
                if (NFLIsChecked)
                {
                    PasserRatingResult = $"NFL Passer Rating: {Math.Round(_calculator.NFLPassRating(), 2)}";
                }
                if (NCAAIsChecked)
                {
                    PasserRatingResult = $"NCAA Passer Rating: {Math.Round(_calculator.NCAAPassRating(), 2)}";
                }
            }
        }