public static double CalculateAverage(List <double> values, IAverageCalculator average) { if (values == null) { throw new ArgumentNullException(nameof(values)); } return(average.FindAverage(values)); }
public DataCollector(IDataPresenter dataPresenter, IPostingCollector postingCollector, ISummaryCalculator summaryCalculator, IAverageCalculator averageCalculator, IMonthlyDeltaCalculator monthlyDeltaCalculator, IClassifiedPostingsCalculator classifiedPostingsCalculator, ICalculationLogger calculationLogger) { DataPresenter = dataPresenter; PostingCollector = postingCollector; SummaryCalculator = summaryCalculator; AverageCalculator = averageCalculator; MonthlyDeltaCalculator = monthlyDeltaCalculator; ClassifiedPostingsCalculator = classifiedPostingsCalculator; CalculationLogger = calculationLogger; }
public double CalculateAverage(List <double> values, IAverageCalculator averageCalculator) { if (ReferenceEquals(values, null)) { throw new ArgumentNullException(nameof(values)); } if (ReferenceEquals(averageCalculator, null)) { throw new ArgumentNullException(nameof(averageCalculator)); } return(averageCalculator.Calculate(values)); }
public VisitsController(ApplicationDbContext context, IWaitCalculator waitcalc, IAverageCalculator avecalc) { _context = context; _waitcalc = waitcalc; _avecalc = avecalc; }
public void Initialize() { InitializeContainerAndDataPresenter(); Sut = Container.Resolve <IAverageCalculator>(); }
public double CalculateDelegate_SuccessTests(List <double> values, IAverageCalculator averageCalculator) { Solution.Delegate.Calculator calculator = new Solution.Delegate.Calculator(); return(calculator.Calculate(values, averageCalculator.Calculate)); }
public void CalculateInterface_FailTests(List <double> values, IAverageCalculator averageCalculator) { Solution.Interface.Calculator calculator = new Solution.Interface.Calculator(); Assert.Throws <ArgumentNullException>(() => calculator.CalculateAverage(values, averageCalculator)); }
public double CalculateInterface_SuccessTests(List <double> values, IAverageCalculator averageCalculator) { Solution.Interface.Calculator calculator = new Solution.Interface.Calculator(); return(calculator.CalculateAverage(values, averageCalculator)); }
public double CalculateAverage(List <double> values, IAverageCalculator calculator) => calculator.CalculateAverage(values);