public WeatherForecastController(ILogger <WeatherForecastController> logger, IForecastService service, IMapper mapper) { _logger = logger; _service = service; _mapper = mapper; }
public UploadService(IServiceProvider serviceProvider, IFaultService faultService, IForecastService weatherService, IStorageService storage) { _provider = serviceProvider; _weatherService = weatherService; _faultService = faultService; _storage = storage; }
public void ProceedCity(IForecastService service, City city) { var result = service.ForecastData(city.Name); var serviceId = _identifier.IdentifierFor(service.GetType()); if (!result.Success) { return; } var data = _forecastRepository .GetAll() .Where(x => x.City.Id == city.Id && x.Service.Id == serviceId); foreach (var item in data) { _forecastRepository.Delete(item.Id); } foreach (var dto in result.Items) { _forecastRepository.Insert(new WeatherForecast { City = city, Date = dto.Date, Humidity = dto.Humidity, DayTemperature = dto.MaxTemperature, Service = new ForecastServiceEntity { Id = serviceId } }); } }
public HomeController(ILogger logger, IForecastService jsonOperations, IUnitOfWork uow, IUserAccount _userAccount) { _logger = logger; forecastService = jsonOperations; ctx = uow; userAccount = _userAccount; }
public void Get_Forecast_Verify_Current_Weather_Mapper_Call() { _mockMapper.Setup(x => x.Map <WeatherForecast>(_mockWeatherForecastResponse)).Returns(new WeatherForecast { DailyForecasts = new List <ForecastDetails>() }); _forecastService = new ForecastService(_openWeatherMapConfig, _mockMapper.Object); _mockGetForecastFunc.Setup(x => x.Invoke(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Returns(Task.FromResult(_mockWeatherForecastResponse)); _mockGetCurrentWeatherFunc.Setup(x => x.Invoke(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Returns(Task.FromResult(_mockCurrentWeatherResponse)); var response = _forecastService.GetForecast(_mockGetForecastFunc.Object, _mockGetCurrentWeatherFunc.Object, It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()); _mockGetForecastFunc.Verify(x => x.Invoke(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()), Times.Once); _mockGetCurrentWeatherFunc.Verify(x => x.Invoke(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()), Times.Once); _mockMapper.Verify(x => x.Map <WeatherForecast>(It.IsAny <WeatherForecastResponse>()), Times.Once); _mockMapper.Verify(x => x.Map <ForecastDetails>(It.IsAny <CurrentWeatherResponse>()), Times.Once); Assert.IsNull(response.Result); }
public ForecastRegistrationViewModel(ForecastRegistrationDataGenerator forecastRegistrationDataGenerator , ProjectSearchViewModel projectSearchViewModel , IForecastService forecastService , ICommonDialogs commonDialogs , SaveForecastCommandHandler saveForecastCommandHandler , ResetForecastCommandHandler resetForecastCommandHandler , CopyPreviousMonthCommandHandler copyPreviousMonthCommandHandler , ForecastTypeProvider forecastTypeProvider , ITimeEntryService timeEntryService , IAppSettings appSettings , ForecastRegistrationSelectedUserHandler selectedUserHandler) { _selectedDate = DateTime.Now.FirstDayOfMonth(); ForecastMonthId = 0; _forecastRegistrationDataGenerator = forecastRegistrationDataGenerator; _projectSearchViewModel = projectSearchViewModel; _forecastService = forecastService; _commonDialogs = commonDialogs; _saveForecastCommandHandler = saveForecastCommandHandler; _resetForecastCommandHandler = resetForecastCommandHandler; _copyPreviousMonthCommandHandler = copyPreviousMonthCommandHandler; _forecastTypeProvider = forecastTypeProvider; _timeEntryService = timeEntryService; _appSettings = appSettings; _selectedUserHandler = selectedUserHandler; _projectRegistrations.InitializeDirtyCheck(); }
public ForecastController(IOptionsMonitor <ApiSettings> optionsMonitor, ILocationService locationService, IForecastService forecastService) { _apiSettings = optionsMonitor.CurrentValue; _locationService = locationService; _forecastService = forecastService; }
public WeatherProvider( ILogger <WeatherProvider> logger, ILocationProvider locationProvider, ICacheRepository <WeatherConditions> cacheRepository, IForecastService forecastService, IOpenWeatherMapService openWeatherMapService, IYahooWeatherService yahooWeatherService) : base(logger, cacheRepository) { try { var location = locationProvider.Execute().Result; if (location == null) { _logger.LogError($"{GetType().Name}: Cannot get Location. Weather will disabled."); } else { _serializedLocation = JsonConvert.SerializeObject(location); _operations.Add(yahooWeatherService); _operations.Add(openWeatherMapService); _operations.Add(forecastService); } } catch (Exception e) { _logger.LogError("WeatherProvider", e); throw e; } }
public SaveForecastCommandHandler(IForecastService forecastService , IUserSession userSession , ForecastRegistrationSelectedUserHandler selectedUserHandler) { _forecastService = forecastService; _userSession = userSession; _selectedUserHandler = selectedUserHandler; }
/// <summary> /// Ctor /// </summary> public ForecastServiceClient(string serviceHostName) { var bnd = new WSHttpBinding(); var endpAddr = new EndpointAddress(string.Format("http://{0}/ForecastService.svc", serviceHostName)); ChannelFactory = new ChannelFactory <IForecastService>(bnd, endpAddr); ServiceChannel = ChannelFactory.CreateChannel(); }
public ForecastServiceTests() { _openWeatherApi = new Mock <IOpenWeatherMapApi>(); _darkSkyApi = new Mock <IDarkSkyApi>(); _cityService = new Mock <ICityService>(); _param = getForecastParam(); _forecastService = new ForecastService(_openWeatherApi.Object, _darkSkyApi.Object, _cityService.Object); }
public ForecastController(IForecastService forecastService, IAuthorizationService authorizationService, IMailServices mailService, IUserService userService) { _forecastService = forecastService; _authorizationService = authorizationService; _mailService = mailService; _userService = userService; }
public ForecastViewModel(INavigationService navigation, IForecastService forecastService, ICityService cityService) { _navigation = navigation; _forecastService = forecastService; _cityService = cityService; MessengerInstance.Register <CitiesRefreshMessage>(this, CitiesRefresh); InitValues(); }
public static Forecast GetForecastByIP(string ipAddress, IForecastService forecastService) { var client = new RestClient("http://ip-api.com"); var request = new RestRequest($"/json/{ipAddress}", Method.GET); var response = client.Execute <IpApiResponse>(request); return(forecastService.GetForecast(response.Data.Lat, response.Data.Lon)); }
public CopyPreviousMonthCommandHandler(IForecastService forecastService , ForecastRegistrationDataGenerator forecastRegistrationDataGenerator , ICommonDialogs commonDialogs , ForecastTypeProvider forecastTypeProvider , MostFrequentDayLayoutSelector mostFrequentDayLayoutSelector , ForecastRegistrationSelectedUserHandler selectedUserHandler) { _forecastService = forecastService; _forecastRegistrationDataGenerator = forecastRegistrationDataGenerator; _commonDialogs = commonDialogs; _forecastTypeProvider = forecastTypeProvider; _mostFrequentDayLayoutSelector = mostFrequentDayLayoutSelector; _selectedUserHandler = selectedUserHandler; }
public void Get_Forecast_Verify_Forecast_Func_Call() { _forecastService = new ForecastService(_openWeatherMapConfig, _mockMapper.Object); _mockGetForecastFunc.Setup(x => x.Invoke(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Returns(Task.FromResult(It.IsAny <WeatherForecastResponse>())); var response = _forecastService.GetForecast(_mockGetForecastFunc.Object, It.IsAny <Func <string, string, string, Task <CurrentWeatherResponse> > >(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()); _mockGetForecastFunc.Verify(x => x.Invoke(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()), Times.Once); Assert.IsNull(response.Result); }
public ForecastOverviewViewModel(ForecastOverviewDataGenerator dataGenerator , IForecastService forecastService , ForecastTypeProvider forecastTypeProvider , IProjectRepository projectRepository , ICompanyRepository companyRepository , ForecastOverviewSearchOptions searchOptions) { _dataGenerator = dataGenerator; _forecastService = forecastService; _forecastTypeProvider = forecastTypeProvider; _projectRepository = projectRepository; _companyRepository = companyRepository; ListOptions = new OverviewListOptions(); SearchOptions = searchOptions; }
public InspectionController( IInspectionService inspectionService, IBeehiveService beehiveService, IApiaryService apiaryService, IForecastService forecastService, IConfiguration configuration, IExcelExportService excelExportService, IBeehiveHelperService beehiveHelperService, UserManager <ApplicationUser> userManager) { this.inspectionService = inspectionService; this.beehiveService = beehiveService; this.apiaryService = apiaryService; this.forecastService = forecastService; this.configuration = configuration; this.excelExportService = excelExportService; this.beehiveHelperService = beehiveHelperService; this.userManager = userManager; }
public LoadingViewModel (INavigation navigation, IForecastService forecastService, RootPage rootPage) { this.rootPage = rootPage; _navigation = navigation; _forecastService = forecastService; LoadingImage = "Radar.png"; IsRefreshButtonVisible = false; IsActivityIndicatorVisible = false; Setup (); if (_geolocator.IsGeolocationEnabled) { GetForecastAsync (); } else { StatusMessage = "GPS is disabled, please enable GPS and refresh."; IsRefreshButtonVisible = true; } }
public void Get_Forecast_Verify_Response() { _forecastService = new ForecastService(_openWeatherMapConfig, _mapper); _mockGetForecastFunc.Setup(x => x.Invoke(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Returns(Task.FromResult(_mockWeatherForecastResponse)); _mockGetCurrentWeatherFunc.Setup(x => x.Invoke(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Returns(Task.FromResult(_mockCurrentWeatherResponse)); var response = _forecastService.GetForecast(_mockGetForecastFunc.Object, _mockGetCurrentWeatherFunc.Object, It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()); Assert.IsInstanceOfType(response.Result, typeof(WeatherForecast)); Assert.AreEqual(_mockWeatherForecastResponse.CityData.Name, response.Result.City); Assert.AreEqual(_mockWeatherForecastResponse.CityData.Country, response.Result.Country); Assert.IsTrue(response.Result.DailyForecasts.Count > 0); }
public LoadingViewModel(INavigation navigation, IForecastService forecastService, RootPage rootPage) { this.rootPage = rootPage; _navigation = navigation; _forecastService = forecastService; LoadingImage = "Radar.png"; IsRefreshButtonVisible = false; IsActivityIndicatorVisible = false; Setup(); if (_geolocator.IsGeolocationEnabled) { GetForecastAsync(); } else { StatusMessage = "GPS is disabled, please enable GPS and refresh."; IsRefreshButtonVisible = true; } }
public ApiaryController( UserManager <ApplicationUser> userManager, IApiaryService apiaryService, IBeehiveService beehiveService, IApiaryNumberService apiaryNumberService, IConfiguration configuration, IForecastService forecastService, IApiaryHelperService apiaryHelperService, IBeehiveHelperService beehiveHelperService, ITemporaryApiaryBeehiveService temporaryApiaryBeehiveService, IExcelExportService excelExportService) { this.userManager = userManager; this.apiaryService = apiaryService; this.beehiveService = beehiveService; this.apiaryNumberService = apiaryNumberService; this.configuration = configuration; this.forecastService = forecastService; this.apiaryHelperService = apiaryHelperService; this.beehiveHelperService = beehiveHelperService; this.temporaryApiaryBeehiveService = temporaryApiaryBeehiveService; this.excelExportService = excelExportService; }
public MainController(IForecastService weatherService, IFaultService faultService, ApplicationDbContext context) { _weatherService = weatherService; _faultService = faultService; _context = context; }
public GetForecastByZipcodeHandler(IForecastService forecastService, IWeatherForecastClient weatherClient) { _forecastService = forecastService; _weatherClient = weatherClient; }
public ForecastOverviewSearchOptions(IForecastService forecastService, ForecastOverviewUserSearchOptions userSearchOptions) { _forecastService = forecastService; _userSearchOptions = userSearchOptions; }
public ForecastController(IForecastService forecastService) { _forecastService = forecastService; }
public WeatherController(IForecastService forecastService) { _forecastService = forecastService; }
public Form1() { InitializeComponent(); try { newsControl = new List<Control>(); analysisControl = new List<Control>(); EndpointAddress stockPriceAddress = new EndpointAddress("http://localhost:90/StockPrice"); EndpointAddress stockNewsAddress = new EndpointAddress("http://localhost:90/StockNews"); EndpointAddress stockFinanceAddress = new EndpointAddress("http://localhost:90/StockFinance"); EndpointAddress stockForecastAddress = new EndpointAddress("http://localhost:90/StockForecast"); BasicHttpBinding stockPriceBinding = new BasicHttpBinding(); BasicHttpBinding stockNewsBinding = new BasicHttpBinding(); WSDualHttpBinding stockForecastBinding = new WSDualHttpBinding(); stockForecastBinding.ClientBaseAddress = new Uri("http://localhost:90/"); stockPriceProxy = ChannelFactory<IStockPrice>.CreateChannel(stockPriceBinding, stockPriceAddress); stockNewsProxy = ChannelFactory<IStockNews>.CreateChannel(stockNewsBinding, stockNewsAddress); stockFinanceProxy = ChannelFactory<IFinancialIndicatorService>.CreateChannel(new BasicHttpBinding(), stockFinanceAddress); InstanceContext insContext = new InstanceContext(this); stockForecastProxy = new ForecastServiceClient(insContext, stockForecastBinding, stockForecastAddress); List<string[]> mostIncrease = stockPriceProxy.GetMostIncrease(); List<string[]> mostDecrease = stockPriceProxy.GetMostDecrease(); List<string[]> mostTraded = stockPriceProxy.GetMostTraded(); DataTable mostIncreaseSource = ToDataTable(mostIncrease, new string[] { "Stock", "Open", "High", "Low", "Close", "Volume", "Change(%)" }, new int[] { 1, 3, 4, 5, 6, 7, 8 }); DataTable mostDecreaseSource = ToDataTable(mostDecrease, new string[] { "Stock", "Open", "High", "Low", "Close", "Volume", "Change(%)" }, new int[] { 1, 3, 4, 5, 6, 7, 8 }); DataTable mostTradedSource = ToDataTable(mostTraded, new string[] { "Stock", "Open", "High", "Low", "Close", "Volume" }, 5); dgvMostIncrease.DataSource = mostIncreaseSource; dgvMostDecrease.DataSource = mostDecreaseSource; dgvMostTraded.DataSource = mostTradedSource; int colCount = dgvMostIncrease.Columns.Count; int colWidth = (dgvMostIncrease.Width - 41) / 7; AutoSizeColumns(dgvMostIncrease, new int[] { 69, 69, 69, 69, 69, 69, 68 }); AutoSizeColumns(dgvMostDecrease, new int[] { 69, 69, 69, 69, 69, 69, 68 }); AutoSizeColumns(dgvMostTraded, new int[] { 80, 80, 80, 80, 81, 81 }); AddNews(stockNewsProxy.GetNews("", Convert.ToInt32(txtViewCount.Value))); AddAnalysis(stockNewsProxy.GetExpertAnalysis("", Convert.ToInt32(txtAnalysisCount.Value))); List<string[]> periodsList = stockFinanceProxy.GetPeriods("HNM"); foreach (string[] period in periodsList) { string result = "Q" + period[0] + "/" + period[1]; cbbQuarter.Items.Add(result); } cbbQuarter.SelectedIndex = cbbQuarter.Items.Count - 1; cbbForecastsNum.SelectedIndex = cbbForecastsNum.Items.Count - 1; } catch (Exception e) { MessageBox.Show("Error connecting to service. Press OK to quit"); Environment.Exit(-1); } }
public WeatherForecastController(ILogger <WeatherForecastController> logger, IForecastService forecastService) { _logger = logger; _forecastService = forecastService; }
public ForecastTypeProvider(IForecastService forecastService) { _forecastService = forecastService; _forecastTypes = new List <ForecastType>(); }
public ForecastHandler(IForecastService forecastService, IHttpContextAccessor httpContextAccessor) : base(httpContextAccessor) { this.forecastService = forecastService; }
public ForecastRegistrationSelectedUserHandler(IUserSession userSession, IForecastService forecastService) { _userSession = userSession; _forecastService = forecastService; }