public static double CalculateAverage(List <double> values, IAverageCalculator average)
        {
            if (values == null)
            {
                throw new ArgumentNullException(nameof(values));
            }

            return(average.FindAverage(values));
        }
示例#2
0
 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 VisitsController(ApplicationDbContext context, IWaitCalculator waitcalc, IAverageCalculator avecalc)
 {
     _context = context;
     _waitcalc = waitcalc;
     _avecalc = avecalc;
 }
示例#6
0
 public void Initialize()
 {
     InitializeContainerAndDataPresenter();
     Sut = Container.Resolve <IAverageCalculator>();
 }
示例#7
0
 public double CalculateDelegate_SuccessTests(List <double> values, IAverageCalculator averageCalculator)
 {
     Solution.Delegate.Calculator calculator = new Solution.Delegate.Calculator();
     return(calculator.Calculate(values, averageCalculator.Calculate));
 }
示例#8
0
 public void CalculateInterface_FailTests(List <double> values, IAverageCalculator averageCalculator)
 {
     Solution.Interface.Calculator calculator = new Solution.Interface.Calculator();
     Assert.Throws <ArgumentNullException>(() => calculator.CalculateAverage(values, averageCalculator));
 }
示例#9
0
 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);