コード例 #1
0
ファイル: Startup.cs プロジェクト: Romarub/ItHappened
        private void AddMultipleTrackersStatisticsProvider(IServiceCollection services)
        {
            var statisticsProvider = new MultipleTrackersFactProvider();

            statisticsProvider.Add(new MostEventfulWeekCalculator());
            statisticsProvider.Add(new MostEventfulDayCalculator());
            statisticsProvider.Add(new MostFrequentEventStatisticsCalculator());
            statisticsProvider.Add(new MultipleTrackersEventsCountCalculator());
            services.AddSingleton <IMultipleTrackersFactProvider>(statisticsProvider);
        }
コード例 #2
0
        private StatisticGenerator InitializeStatisticGeneratorWithTwoCalculators()
        {
            var generalFactProvider = new MultipleTrackersFactProvider();

            generalFactProvider.Add(new MostEventfulDayCalculator());
            var specificFactProvider = new SingleTrackerFactProvider();

            specificFactProvider.Add(new SingleTrackerEventsCountCalculator());

            _singleFactsRepository   = new SingleFactsRepository();
            _multipleFactsRepository = new MultipleFactsRepository();
            _trackerRepository       = new TrackerRepository();
            _eventRepository         = new EventRepository();
            return(new StatisticGenerator(_multipleFactsRepository,
                                          generalFactProvider,
                                          specificFactProvider,
                                          _singleFactsRepository,
                                          _trackerRepository,
                                          _eventRepository));
        }