public SettingsHelper(IDataFetcher parent, IList <TBase> col, PropertyInfo keyfield, PropertyInfo valuefield) { m_parent = parent; m_col = col; m_keyfield = keyfield; m_valuefield = valuefield; if (m_parent == null) { throw new ArgumentNullException("parent"); } if (m_col == null) { throw new ArgumentNullException("col"); } if (m_keyfield == null) { throw new ArgumentNullException("keyfield"); } if (m_valuefield == null) { throw new ArgumentNullException("valuefield"); } parent.AfterDataConnection += new DataConnectionEventHandler(parent_AfterDataConnection); }
public DepartureBoardPeriodicUpdater(IDataFetcher dataFetcher, ILogger <DepartureBoardPeriodicUpdater> logger) { this.dataFetcher = dataFetcher; this.logger = logger; whenUpdatedSubject = new Subject <IEnumerable <IStopArea> >(); }
public SimpleRunner(IDataFetcher dataFetcher, IFileCreator fileCreator, ILogger <SimpleRunner> logger, IOptions <AppSettings> settings) { _dataFetcher = dataFetcher; _fileCreator = fileCreator; _mySettings = settings.Value; _logger = logger; }
public async Task TelemetryParser_ParseNumericValues() { IKernel kernel = new StandardKernel(); kernel.Bind <IDataFetcher>().To <MockDataFetcher>(); kernel.Bind <IDataSaver>().To <CSVDataSaver>(); IDataFetcher dataFetcher = kernel.Get <IDataFetcher>(); IDataSaver dataSaver = kernel.Get <IDataSaver>(); var telemetryParser = new TelemetryParser(dataFetcher, dataSaver); await telemetryParser.UpdateData(); var actualValues = telemetryParser.FetchNumericData(); var expectedNumericValues = new Dictionary <string, double>() { { "Humidity", 40 }, { "Pressure", 1000 }, { "Light_intensity", 0 }, { "No_of_lamps", 1 }, { "Temperature", 25 }, { "No_of_airfans", 0 }, { "No_of_heaters", 0 } }; CollectionAssert.AreEquivalent(expectedNumericValues, actualValues); }
public void Setup(IDataFetcher connection, bool allowEdit, bool onlyFolders) { m_connection = connection; m_allowEdit = allowEdit; List <Schedule> lst; lock (Program.DataConnection) lst = new List <Schedule>(m_connection.GetObjects <Schedule>()); treeView.Nodes.Clear(); foreach (Schedule s in lst) { TreeNode t = new TreeNode(s.Name); t.ImageIndex = t.SelectedImageIndex = imageList.Images.IndexOfKey("Backup"); t.Tag = s; TreeNodeCollection col; if (string.IsNullOrEmpty(s.Path)) { col = treeView.Nodes; } else { col = FindNode(s.Path, true); } if (!onlyFolders) { col.Add(t); } } treeView.LabelEdit = m_allowEdit; }
public decimal CalcFoo(IDataFetcher df) { var data = df.GetData(); var result = data.Take(100).Average(); return(result); }
public void Setup(UIViewController view, IDataFetcher fetcher) { _parentViewController = view; DataFetcher = fetcher; AutoCompleteViewSource = new DefaultDataSource(); initialize(); }
/// <summary> /// Initializes a new instance of the <see cref="SdkConfiguration"/> class /// </summary> public SdkConfigurationInternal(ISdkConfiguration config, IDataFetcher dataFetcher) : base(config.Username, config.Password, config.Host, config.VirtualHost, config.UseSsl, config.SslServerName, config.NodeId, config.BookmakerId, config.LimitId, config.Currency, config.Channel, config.AccessToken, config.UfEnvironment, config.ProvideAdditionalMarketSpecifiers, config.Port, config.ExclusiveConsumer) { Guard.Argument(config, nameof(config)).NotNull(); ApiHost = null; switch (config.UfEnvironment) { case Entities.Enums.UfEnvironment.Integration: ApiHost = SdkInfo.ApiHostIntegration; return; case Entities.Enums.UfEnvironment.Production: ApiHost = SdkInfo.ApiHostProduction; return; } if (dataFetcher == null) { ApiHost = SdkInfo.ApiHostIntegration; } else { try { var result = dataFetcher.GetDataAsync(new Uri($"{SdkInfo.ApiHostProduction}/v1/users/whoami.xml")).Result; ApiHost = SdkInfo.ApiHostProduction; result.Close(); } catch (Exception) { ApiHost = SdkInfo.ApiHostIntegration; } } }
public void Setup() { Mock <IDataFetcher> dataFetcherFailureMock = new Mock <IDataFetcher>(); dataFetcherFailureMock.Setup(x => x.UpdateData()).ReturnsAsync(string.Empty); dataFetcherFailure = dataFetcherFailureMock.Object; }
public void Setup(UIViewController view, IDataFetcher <IMvxNotifyPropertyChanged> fetcher) { _parentViewController = view; DataFetcher = fetcher; AutoCompleteViewSource = new DefaultDataSource(); initialize(); }
/// <summary> /// Initializes a new instance of the <see cref="ConnectionValidator"/> class. /// </summary> /// <param name="config">A <see cref="IOddsFeedConfigurationInternal"/> instance representing odds configuration.</param> /// <param name="dataFetcher">A <see cref="IDataFetcher"/> instance used to execute http requests</param> public ConnectionValidator(IOddsFeedConfigurationInternal config, IDataFetcher dataFetcher) { Contract.Requires(config != null); Contract.Requires(dataFetcher != null); _config = config; _dataFetcher = dataFetcher; }
public static void SaveExtensionSettings(IDataFetcher connection, IDictionary <string, string> env) { //If there are any control extensions, let them modify the environement foreach (Library.Interface.ISettingsControl ic in Library.DynamicLoader.SettingsControlLoader.Modules) { ic.EndEdit(env, SettingExtension.GetExtensions(connection, ic.Key)); } }
public SiteSaver(IDataFetcher dataFetcher, ILinkParser linkParser, IFileHandler fileHandler, string invalidResourceTag) { _dataFetcher = dataFetcher; _linkParser = linkParser; _fileHandler = fileHandler; _invalidResourceTag = invalidResourceTag; _linkTracker = new ConcurrentDictionary <string, byte>(); }
/// <summary> /// Initializes a new instance of the <see cref="ConnectionValidator"/> class. /// </summary> /// <param name="config">A <see cref="IOddsFeedConfigurationInternal"/> instance representing odds configuration.</param> /// <param name="dataFetcher">A <see cref="IDataFetcher"/> instance used to execute http requests</param> public ConnectionValidator(IOddsFeedConfigurationInternal config, IDataFetcher dataFetcher) { Guard.Argument(config, nameof(config)).NotNull(); Guard.Argument(dataFetcher, nameof(dataFetcher)).NotNull(); _config = config; _dataFetcher = dataFetcher; }
public void Setup() { _dataFetcher = Substitute.For <IDataFetcher>(); _linkParser = Substitute.For <ILinkParser>(); var fileHandler = Substitute.For <IFileHandler>(); var invalidLinkTag = "@@@@@"; _sut = new SiteSaver(_dataFetcher, _linkParser, fileHandler, invalidLinkTag); }
/// <summary> /// Initializes a new instance of the <see cref="DataProvider{T, T1}" /> class /// </summary> /// <param name="uriFormat">The url format specifying the url of the resources fetched by the fetcher</param> /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param> /// <param name="xmlElementName">The name of the xml element containing id / description attributes</param> public NamedValueDataProvider(string uriFormat, IDataFetcher fetcher, string xmlElementName) { Contract.Requires(!string.IsNullOrWhiteSpace(uriFormat)); Contract.Requires(fetcher != null); Contract.Requires(!string.IsNullOrEmpty(xmlElementName)); _uriFormat = uriFormat; _fetcher = fetcher; _xmlElementName = xmlElementName; }
public TelemetryParser(IDataFetcher dataFetcher, IDataSaver dataSaver) { this.dataSaver = dataSaver; this.dataFetcher = dataFetcher; telemetry = new TelemetryStorage(); jsonSerializerOptions = new JsonSerializerOptions { PropertyNameCaseInsensitive = true, }; }
/// <summary> /// Initializes a new instance of the <see cref="DataProvider{T, T1}" /> class /// </summary> /// <param name="uriFormat">The url format specifying the url of the resources fetched by the fetcher</param> /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param> /// <param name="deserializer">A <see cref="IDeserializer{T}" /> used to deserialize the fetch data</param> public NonMappingDataProvider(string uriFormat, IDataFetcher fetcher, IDeserializer <T> deserializer) { Contract.Requires(!string.IsNullOrWhiteSpace(uriFormat)); Contract.Requires(fetcher != null); Contract.Requires(deserializer != null); _uriFormat = uriFormat; _fetcher = fetcher; _deserializer = deserializer; }
/// <summary> /// Initializes a new instance of the <see cref="DataProvider{T, T1}" /> class /// </summary> /// <param name="uriFormat">The url format specifying the url of the resources fetched by the fetcher</param> /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param> /// <param name="xmlElementName">The name of the XML element containing id / description attributes</param> public NamedValueDataProvider(string uriFormat, IDataFetcher fetcher, string xmlElementName) { Guard.Argument(uriFormat, nameof(uriFormat)).NotNull().NotEmpty(); Guard.Argument(fetcher, nameof(fetcher)).NotNull(); Guard.Argument(xmlElementName, nameof(xmlElementName)).NotNull().NotEmpty(); _uriFormat = uriFormat; _fetcher = fetcher; _xmlElementName = xmlElementName; }
/// <summary> /// Initializes a new instance of the <see cref="DataProvider{T, T1}" /> class /// </summary> /// <param name="uriFormat">The url format specifying the url of the resources fetched by the fetcher</param> /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param> /// <param name="deserializer">A <see cref="IDeserializer{T}" /> used to deserialize the fetch data</param> public NonMappingDataProvider(string uriFormat, IDataFetcher fetcher, IDeserializer <T> deserializer) { Guard.Argument(uriFormat, nameof(uriFormat)).NotNull().NotEmpty(); Guard.Argument(fetcher, nameof(fetcher)).NotNull(); Guard.Argument(deserializer, nameof(deserializer)).NotNull(); _uriFormat = uriFormat; _fetcher = fetcher; _deserializer = deserializer; }
/// <summary> /// Initializes a new instance of the <see cref="TournamentRaceScheduleProvider"/> class /// </summary> /// <param name="dateScheduleUriFormat">An address format used to retrieve sport events for a specified date</param> /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param> /// <param name="deserializer">A <see cref="IDeserializer{scheduleType}" /> used to deserialize the fetch data</param> /// <param name="mapperFactory">A <see cref="ISingleTypeMapperFactory{scheduleType, EntityList}" /> used to construct instances of <see cref="ISingleTypeMapper{ISportEventsSchedule}" /></param> public TournamentRaceScheduleProvider(string dateScheduleUriFormat, IDataFetcher fetcher, IDeserializer <raceScheduleEndpoint> deserializer, ISingleTypeMapperFactory <raceScheduleEndpoint, EntityList <SportEventSummaryDTO> > mapperFactory) : base(dateScheduleUriFormat, fetcher, deserializer, mapperFactory) { Guard.Argument(dateScheduleUriFormat, nameof(dateScheduleUriFormat)).NotNull().NotEmpty(); Guard.Argument(fetcher, nameof(fetcher)).NotNull(); Guard.Argument(deserializer, nameof(deserializer)).NotNull(); Guard.Argument(mapperFactory, nameof(mapperFactory)).NotNull(); }
/// <summary> /// Initializes a new instance of the <see cref="ListSportAvailableTournamentProvider"/> class /// </summary> /// <param name="baseUriFormat">An address format used to retrieve list of sport events</param> /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param> /// <param name="deserializer">A <see cref="IDeserializer{sportTournamentsEndpoint}" /> used to deserialize the fetch data</param> /// <param name="mapperFactory">A <see cref="ISingleTypeMapperFactory{sportTournamentsEndpoint, EntityList}" /> used to construct instances of <see cref="ISingleTypeMapper{ITournament}" /></param> public ListSportAvailableTournamentProvider(string baseUriFormat, IDataFetcher fetcher, IDeserializer <sportTournamentsEndpoint> deserializer, ISingleTypeMapperFactory <sportTournamentsEndpoint, EntityList <TournamentInfoDTO> > mapperFactory) : base(baseUriFormat, fetcher, deserializer, mapperFactory) { Guard.Argument(baseUriFormat, nameof(baseUriFormat)).NotNull().NotEmpty(); Guard.Argument(fetcher, nameof(fetcher)).NotNull(); Guard.Argument(deserializer, nameof(deserializer)).NotNull(); Guard.Argument(mapperFactory, nameof(mapperFactory)).NotNull(); }
/// <summary> /// Initializes a new instance of the <see cref="DataProvider{T, T1}" /> class. /// </summary> /// <param name="uriFormat">The url format specifying the url of the resources fetched by the fetcher</param> /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param> /// <param name="deserializer">A <see cref="IDeserializer{T}" /> used to deserialize the fetch data</param> /// <param name="mapperFactory">A <see cref="ISingleTypeMapperFactory{T, T1}" /> used to construct instances of <see cref="ISingleTypeMapper{T}" /></param> public DataProvider(string uriFormat, IDataFetcher fetcher, IDeserializer <TIn> deserializer, ISingleTypeMapperFactory <TIn, TOut> mapperFactory) { Guard.Argument(uriFormat, nameof(uriFormat)).NotNull().NotEmpty(); Guard.Argument(fetcher, nameof(fetcher)).NotNull(); Guard.Argument(deserializer, nameof(deserializer)).NotNull(); Guard.Argument(mapperFactory, nameof(mapperFactory)).NotNull(); _uriFormat = uriFormat; _fetcher = fetcher; _deserializer = deserializer; _mapperFactory = mapperFactory; }
/// <summary> /// Initializes a new instance of the <see cref="ListSportEventsProvider"/> class /// </summary> /// <param name="baseUriFormat">An address format used to retrieve list of sport events</param> /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param> /// <param name="deserializer">A <see cref="IDeserializer{scheduleEndpoint}" /> used to deserialize the fetch data</param> /// <param name="mapperFactory">A <see cref="ISingleTypeMapperFactory{scheduleEndpoint, EntityList}" /> used to construct instances of <see cref="ISingleTypeMapper{ISportEventsSchedule}" /></param> public ListSportEventsProvider( string baseUriFormat, IDataFetcher fetcher, IDeserializer <scheduleEndpoint> deserializer, ISingleTypeMapperFactory <scheduleEndpoint, EntityList <SportEventSummaryDTO> > mapperFactory) : base(baseUriFormat, fetcher, deserializer, mapperFactory) { Contract.Requires(!string.IsNullOrWhiteSpace(baseUriFormat)); Contract.Requires(fetcher != null); Contract.Requires(deserializer != null); Contract.Requires(mapperFactory != null); }
/// <summary> /// Initializes a new instance of the <see cref="DataProvider{T, T1}" /> class. /// </summary> /// <param name="uriFormat">The url format specifying the url of the resources fetched by the fetcher</param> /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param> /// <param name="deserializer">A <see cref="IDeserializer{T}" /> used to deserialize the fetch data</param> /// <param name="mapperFactory">A <see cref="ISingleTypeMapperFactory{T, T1}" /> used to construct instances of <see cref="ISingleTypeMapper{T}" /></param> public DataProvider(string uriFormat, IDataFetcher fetcher, IDeserializer <TIn> deserializer, ISingleTypeMapperFactory <TIn, TOut> mapperFactory) { Contract.Requires(!string.IsNullOrWhiteSpace(uriFormat)); Contract.Requires(fetcher != null); Contract.Requires(deserializer != null); Contract.Requires(mapperFactory != null); _uriFormat = uriFormat; _fetcher = fetcher; _deserializer = deserializer; _mapperFactory = mapperFactory; }
public static Dictionary <string, string> GetApplicationSettings(IDataFetcher connection) { Dictionary <string, string> env = new ApplicationSettings(connection).CreateDetachedCopy(); //If there are any control extensions, let them modify the environement foreach (Library.Interface.ISettingsControl ic in Library.DynamicLoader.SettingsControlLoader.Modules) { ic.BeginEdit(env, SettingExtension.GetExtensions(connection, ic.Key)); } return(env); }
/// <summary> /// Initializes a new instance of the <see cref="DateScheduleProvider" /> class. /// </summary> /// <param name="dateScheduleUriFormat">An address format used to retrieve sport events for a specified date</param> /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param> /// <param name="deserializer">A <see cref="IDeserializer{T}" /> used to deserialize the fetch data</param> /// <param name="mapperFactory"> /// A <see cref="ISingleTypeMapperFactory{TIn,TOut}" /> used to construct instances of /// <see cref="ISingleTypeMapper{ISportEventsSchedule}" /> /// </param> public TournamentScheduleProvider( string dateScheduleUriFormat, IDataFetcher fetcher, IDeserializer <tournamentSchedule> deserializer, ISingleTypeMapperFactory <tournamentSchedule, EntityList <SportEventSummaryDTO> > mapperFactory) : base(dateScheduleUriFormat, fetcher, deserializer, mapperFactory) { Contract.Requires(!string.IsNullOrWhiteSpace(dateScheduleUriFormat)); Contract.Requires(fetcher != null); Contract.Requires(deserializer != null); Contract.Requires(mapperFactory != null); }
public ChangesNotifierFacade(IDataAnalyzer analyzer, IDataFetcher externalSource, IDataStorageProvider dataStorage, INotificationManager notificator) { Analyzer = analyzer; Analyzer.DetectedDifferenceEvent += Analyzer_DetectedDifferenceEvent; Analyzer.ErrorEvent += Analyzer_ErrorEvent; ExternalSource = externalSource; DataStorage = dataStorage; Notificator = notificator; }
/// <summary> /// Initializes a new instance of the <see cref="SportEventSummaryProvider" /> class /// </summary> /// <param name="sportEventSummaryUriFormat">An address format used to retrieve sport event summary</param> /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param> /// <param name="deserializer">A <see cref="IDeserializer{T}" /> used to deserialize the fetch data</param> /// <param name="mapperFactory"> /// A <see cref="ISingleTypeMapperFactory{TIn,TOut}" /> used to construct instances of /// <see cref="ISingleTypeMapper{ISportEventsSchedule}" /> /// </param> public SportEventSummaryProvider( string sportEventSummaryUriFormat, IDataFetcher fetcher, IDeserializer <RestMessage> deserializer, ISingleTypeMapperFactory <RestMessage, EntityList <SportEventSummaryDTO> > mapperFactory) : base(sportEventSummaryUriFormat, fetcher, deserializer, mapperFactory) { Contract.Requires(!string.IsNullOrEmpty(sportEventSummaryUriFormat)); Contract.Requires(fetcher != null); Contract.Requires(deserializer != null); Contract.Requires(mapperFactory != null); _sportEventSummaryUriFormat = sportEventSummaryUriFormat; }
/// <summary> /// Initializes a new instance of the <see cref="SportEventSummaryProvider"/> class /// </summary> /// <param name="sportEventSummaryUriFormat">An address format used to retrieve sport event summary</param> /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param> /// <param name="deserializer">A <see cref="IDeserializer{scheduleType}" /> used to deserialize the fetch data</param> /// <param name="mapperFactory">A <see cref="ISingleTypeMapperFactory{scheduleType, EntityList}" /> used to construct instances of <see cref="ISingleTypeMapper{ISportEventsSchedule}" /></param> public SportEventSummaryProvider( string sportEventSummaryUriFormat, IDataFetcher fetcher, IDeserializer <RestMessage> deserializer, ISingleTypeMapperFactory <RestMessage, EntityList <SportEventSummaryDTO> > mapperFactory) : base(sportEventSummaryUriFormat, fetcher, deserializer, mapperFactory) { Guard.Argument(sportEventSummaryUriFormat, nameof(sportEventSummaryUriFormat)).NotNull().NotEmpty(); Guard.Argument(fetcher, nameof(fetcher)).NotNull(); Guard.Argument(deserializer, nameof(deserializer)).NotNull(); Guard.Argument(mapperFactory, nameof(mapperFactory)).NotNull(); _sportEventSummaryUriFormat = sportEventSummaryUriFormat; }
public static void SaveExtensionSettings(IDataFetcher connection, IDictionary<string, string> env) { //If there are any control extensions, let them modify the environement foreach (Library.Interface.ISettingsControl ic in Library.DynamicLoader.SettingsControlLoader.Modules) ic.EndEdit(env, SettingExtension.GetExtensions(connection, ic.Key)); }
public static Dictionary<string, string> GetApplicationSettings(IDataFetcher connection) { Dictionary<string, string> env = new ApplicationSettings(connection).CreateDetachedCopy(); //If there are any control extensions, let them modify the environement foreach (Library.Interface.ISettingsControl ic in Library.DynamicLoader.SettingsControlLoader.Modules) ic.BeginEdit(env, SettingExtension.GetExtensions(connection, ic.Key)); return env; }
public ReportPrinter(IDataFetcher dataFetcher, IDocumentFormatter documentFormatter) { _dataFetcher = dataFetcher; _documentFormatter = documentFormatter; }
public ApplicationSettings(IDataFetcher dataparent) { m_appset = new SettingsHelper<ApplicationSetting, string, string>(dataparent, new List<ApplicationSetting>(dataparent.GetObjects<ApplicationSetting>()), "Name", "Value"); }
public void Setup(IDataFetcher connection, bool allowEdit, bool onlyFolders) { m_connection = connection; m_allowEdit = allowEdit; List<Schedule> lst; lock (Program.DataConnection) lst = new List<Schedule>(m_connection.GetObjects<Schedule>()); treeView.Nodes.Clear(); foreach (Schedule s in lst) { TreeNode t = new TreeNode(s.Name); t.ImageIndex = t.SelectedImageIndex = imageList.Images.IndexOfKey("Backup"); t.Tag = s; TreeNodeCollection col; if (string.IsNullOrEmpty(s.Path)) col = treeView.Nodes; else col = FindNode(s.Path, true); if (!onlyFolders) col.Add(t); } treeView.LabelEdit = m_allowEdit; }