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); }
public void NCAAPassRating_Worst_LowerLimit() { //arrange var calculator = new PassingCalculator(100, 100, -9900, 0, 0); //act var result = calculator.NCAAPassRating(); //assert Assert.AreEqual(-731.6, result); }
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); }
public void NCAAPassRating_Best_UpperLimit() { //arrange var calculator = new PassingCalculator(100, 100, 9900, 100, 0); //act var result = calculator.NCAAPassRating(); //assert Assert.AreEqual(1261.6, result); }
public void NCAAPassRating_AlmostBest_LessThanUpperLimit() { //arrange var calculator = new PassingCalculator(100, 100, 9899, 100, 0); //act var result = calculator.NCAAPassRating(); //assert Assert.IsTrue(1261.6 > result); }
public void NCAAPassRating_InterceptionsOnly_Negative200() { //arrange var calculator = new PassingCalculator(100, 0, 0, 0, 100); //act var result = calculator.NCAAPassRating(); //assert Assert.AreEqual(-200, result); }
public void NCAAPassRating_AlmostWorst_GreaterThanLowerLimit() { //arrange var calculator = new PassingCalculator(100, 100, -9899, 0, 0); //act var result = calculator.NCAAPassRating(); //assert Assert.IsTrue(-731.6 < result); }
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); }
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); }
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); }
public MainWindowVM() { _resetCommand = new DelegateCommand(Reset, CanReset); _calculator = new PassingCalculator(); //throw attempt rules Rules.Add(new DelegateRule <MainWindowVM>( nameof(ThrowAttempts), "Attempts field is required.", f => f.ThrowAttempts.HasValue)); Rules.Add(new DelegateRule <MainWindowVM>( nameof(ThrowAttempts), "Attempts must be a non-negative whole number.", f => f.NonNegWholeIntField(f.ThrowAttempts))); //pass completion rules Rules.Add(new DelegateRule <MainWindowVM>( nameof(PassCompletion), "Pass Completion is required.", f => f.PassCompletion.HasValue)); Rules.Add(new DelegateRule <MainWindowVM>( nameof(PassCompletion), "Pass Completion must be a non-negative whole number.", f => f.NonNegWholeIntField(f.PassCompletion))); Rules.Add(new DelegateRule <MainWindowVM>( nameof(PassCompletion), "Pass Completion must less than or equal to Attempts.", f => f.NotLargerThanDependentField(f.PassCompletion, f.ThrowAttempts))); //Passing Yard rules Rules.Add(new DelegateRule <MainWindowVM>( nameof(PassingYards), "Passing Yards is required.", f => f.PassingYards.HasValue)); Rules.Add(new DelegateRule <MainWindowVM>( nameof(PassingYards), "Passing Yards cannot be less than -99 * Attempts or greater than 99 * Completed Passes.", f => f.FieldLessThan99TimesDependent(f.PassingYards, f.PassCompletion))); //Touchdown rules Rules.Add(new DelegateRule <MainWindowVM>( nameof(Touchdowns), "Touchdowns is required.", f => f.Touchdowns.HasValue)); Rules.Add(new DelegateRule <MainWindowVM>( nameof(Touchdowns), "Touchdowns must be a non-negative whole number.", f => f.NonNegWholeIntField(f.Touchdowns))); Rules.Add(new DelegateRule <MainWindowVM>( nameof(Touchdowns), "Touchdowns must less than or equal to Completions.", f => f.NotLargerThanDependentField(f.Touchdowns, f.PassCompletion))); //Interception rules Rules.Add(new DelegateRule <MainWindowVM>( nameof(Interceptions), "Interceptions is required.", f => f.Interceptions.HasValue)); Rules.Add(new DelegateRule <MainWindowVM>( nameof(Interceptions), "Interceptions must be a non-negative whole number.", f => f.NonNegWholeIntField(f.Interceptions))); Rules.Add(new DelegateRule <MainWindowVM>( nameof(Interceptions), "Interceptions must less than or equal to Attempts.", f => f.NotLargerThanDependentField(f.Interceptions, f.ThrowAttempts))); }