public CalculatorPresenter(ICalculatorView view) : base(view) { var namesList = BaseCalculation.GetNamesList <CalculationType>(); fView.TypeCombo.AddRange(namesList, false); fView.TypeCombo.SetSelectedTag <CalculationType>(CalculationType.Units_cm2inch); }
public void ResetCalculationCheck() { BaseCalculation calc = new BaseCalculation(); calc.RequiredInput = true; calc.Run(new OutputBuilder()); Assert.IsTrue(calc.TestOutput); Assert.IsTrue(calc.Calculated); calc.ResetCalculation(); Assert.IsNull(calc.TestOutput); Assert.IsFalse(calc.Calculated); }
public void ChangeSelectedType() { CalculationType calcType = fView.TypeCombo.GetSelectedTag <CalculationType>(); if (calcType >= CalculationType.Units_cm2inch && calcType <= CalculationType.Units_ConvGHppm2GHdeg) { fCalculation = new UnitsCalculation(calcType); } else { switch (calcType) { case CalculationType.NitriteSaltCalculator: fCalculation = new SaltCalculation(calcType); break; } } fView.ArgsGrid.SelectedObject = fCalculation; fView.DescriptionField.Text = fCalculation.Description; fView.ArgsGrid.Refresh(); }
public void VerifyInputsCheck() { BaseCalculation calc = new BaseCalculation(); Assert.Throws(typeof(ArgumentNullException), () => calc.VerifyInputs()); }