public MainChartViewModel(IForecastProvider forecastProvider, IDialogController dialogController, ICsvFileCreator csvFileCreator, IDateFormater dateFormater, TimeSpan timeSpan) { //Один шаг зума увеличивает на 0,8 текущего диапозона, отсчитаем 3 зума назад _startScale = Math.Round(RangeMaxScale / 1.8 / 1.8, 3); _timeSpanTicks = timeSpan.Ticks; IsDataSated = false; _dialogController = dialogController; _csvFileCreator = csvFileCreator; _forecastProvider = forecastProvider; _forecastProvider.OnForecastUpdated += OnForecastUpdated; _forecastProvider.OnConnectionLost += OnConnectionLosted; _forecastProvider.OnConnectionRestored += OnConnectionRestored; dateFormatter = dateFormater.DateFormatter; simpleDateFormatter = dateFormater.SimpleDateFormatter; ForecastMapper = Mappers.Xy <Forecast>() .X(item => item.ForecastTime.Ticks) .Y(item => item.IsForecast ? item.ForecastPower : Double.NaN); MeasurementsMapper = Mappers.Xy <Forecast>() .X(item => item.ForecastTime.Ticks) .Y(item => !item.IsForecast ? item.ForecastPower : item.ForecastPower); AllDataMapper = Mappers.Xy <Forecast>() .X(item => item.ForecastTime.Ticks) .Y(item => item.ForecastPower); }
/// <summary> Задать бизнеслогику страницы </summary> public override void SetupBuisnesLogic() { base.SetupBuisnesLogic(); var forecastConnection = GetForecastConnection(); _forecastProvider = new ForecastProvider(forecastConnection, TimeSpan.FromMinutes(5)); _csvFileCreator = new CsvFileCreator(); }
public TradesGroupReportGenerator(IOutputCsvFileWrapper outputCsvFileWrapper, ICsvFileCreator csvFileCreator) { _outputCsvFileWrapper = outputCsvFileWrapper; _csvFileCreator = csvFileCreator; }
public TradesGroupReportGeneratorShould() { _outputCsvFileWrapper = Substitute.For <IOutputCsvFileWrapper>(); _csvFileCreator = new CsvFileCreator();//no need to test System.IO methods _tradesGroupReportGenerator = new TradesGroupReportGenerator(_outputCsvFileWrapper, _csvFileCreator); }