コード例 #1
0
 public WebDataService(string key)
 {
     //default to ComicVine
     this.connection = new ComicVineWebConnection();
     this.reader     = new ComicVineXMLReader();
     this.urlBuilder = new ComicVineURLBuilder(key, format);
 }
コード例 #2
0
 public WebDataService(string key)
 {
     //default to ComicVine
     this.connection = new ComicVineWebConnection();
     this.reader = new ComicVineXMLReader();
     this.urlBuilder = new ComicVineURLBuilder(key, format);
 }
コード例 #3
0
        public void GenerateDiscoverTVURLWithGenresSortByPopularityDescPage3()
        {
            newManufacturer = new URLManufacturer();
            urlBuilder = new DiscoverTVURLBuilder(3);

            newManufacturer.Construct(urlBuilder);
            string[] myGenres =
            {
                TMDBConstants.WITHGENRES,
                TMDBConstants.ORSEPARATOR,
                "" + (int) TMDBConstants.Genres.Drama,
                "" + (int) TMDBConstants.Genres.Action,
                "" + (int) TMDBConstants.Genres.SciFi
            };
            urlBuilder.AddDesiredParameters(myGenres);

            string[] sortByParam =
            {
                TMDBConstants.SORTBY,
                TMDBConstants.POPULARITYDESC
            };
            urlBuilder.AddDesiredParameters(sortByParam);

            Assert.AreEqual("https://api.themoviedb.org/3/discover/tv?" +
                            TMDBConstants.TMDBAPIKEY + "&page=3&with_genres=" + (int) TMDBConstants.Genres.Drama
                            + "|" + (int) TMDBConstants.Genres.Action + "|" + (int) TMDBConstants.Genres.SciFi +
                            "&sort_by=" + TMDBConstants.POPULARITYDESC,
                urlBuilder.BuiltURL);

        }
コード例 #4
0
ファイル: URLManufacturer.cs プロジェクト: robobat/Trakker
		public void Construct (IURLBuilder urlBuilder)
		{
			urlBuilder.BuildStartOfURL ();
			urlBuilder.AddSpecificSearch ();
			urlBuilder.AddParameterStartAndAPIKey ();
			urlBuilder.AddPageNum ();
			//urlBuilder.AddDesiredParameters ();
		}
コード例 #5
0
        public void GenerateBaseDiscoverTVURLPage1()
        {
            newManufacturer = new URLManufacturer();
            urlBuilder = new DiscoverTVURLBuilder(1);

            newManufacturer.Construct(urlBuilder);

            Assert.AreEqual("https://api.themoviedb.org/3/discover/tv?" + TMDBConstants.TMDBAPIKEY + "&page=1",
                urlBuilder.BuiltURL);
        }
コード例 #6
0
        private bool AssignInitializeWeatherData()
        {
            try
            {
                if (CitiesComboBox.SelectedItem.GetType().Equals((new ComboBoxItem()).GetType()))
                {
                    _city = ((ComboBoxItem)CitiesComboBox.SelectedItem).Content.ToString();
                }
                else
                {
                    _city = CitiesComboBox.SelectedItem.ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Message returned by application: {ex.Message} \n Probably city name is invalid. \n Selected item is {CitiesComboBox.SelectedItem.GetType()}");
                return(false);
            }

            if (OpenWeatherServiceRadio.IsChecked == true)
            {
                try
                {
                    _baseURL           = @"http://api.openweathermap.org/data/2.5/weather";
                    _urlBuilder        = new OpenWeatherAPIURLBuilder(_baseURL, _apiKey);
                    _weatherDownloader = new OpenWeatherDownloader(_urlBuilder);
                    _weatherData       = new OpenWeatherObject();
                    _dataBinder        = new OpenWeatherDataBinder <OpenWeatherObject>();
                    _weatherDownloader.DownloadDataByCity(_city);
                    _weatherData = _dataBinder.DeserializeJSON(_weatherDownloader.PushURL());
                }
                catch (Exception ex)
                {
                    MessageBox.Show($"Error: {ex.Message}");
                    return(false);
                }
            }

            if (CitiesComboBox.SelectedItem == null || CitiesComboBox.SelectedItem.ToString().Length == 0)
            {
                MessageBox.Show("You have not selected city!");
                return(false);
            }

            return(true);
        }
コード例 #7
0
        public void Setup()
        {
            if (testMode == "Live")
            {
                repository = new MSSQLDatabase();
                connection = new ComicVineWebConnection();
            }
            else
            {
                repository = new TestRepository();
                connection = new TestWebConnection();
            }

            key = repository.GetSetting("WebServiceKey");
            format = "xml";

            urlBuilder = new ComicVineURLBuilder(key, format);
            reader = new ComicVineXMLReader();
            service = new WebDataService(connection, reader, urlBuilder);
        }
コード例 #8
0
        public void Setup()
        {
            if (testMode == "Live")
            {
                repository = new MSSQLDatabase();
                connection = new ComicVineWebConnection();
            }
            else
            {
                repository = new TestRepository();
                connection = new TestWebConnection();
            }

            key    = repository.GetSetting("WebServiceKey");
            format = "xml";

            urlBuilder = new ComicVineURLBuilder(key, format);
            reader     = new ComicVineXMLReader();
            service    = new WebDataService(connection, reader, urlBuilder);
        }
コード例 #9
0
        public void GenerateDiscoverTVURLWithGenres()
        {
            newManufacturer = new URLManufacturer();
            urlBuilder = new DiscoverTVURLBuilder(1);

            newManufacturer.Construct(urlBuilder);

            string[] myGenres =
            {
                TMDBConstants.WITHGENRES,
                TMDBConstants.ORSEPARATOR,
                "" + (int) TMDBConstants.Genres.Drama,
                "" + (int) TMDBConstants.Genres.Action,
                "" + (int) TMDBConstants.Genres.SciFi
            };
            urlBuilder.AddDesiredParameters(myGenres);

            Assert.AreEqual("https://api.themoviedb.org/3/discover/tv?" +
                            TMDBConstants.TMDBAPIKEY + "&page=1&with_genres=" + (int) TMDBConstants.Genres.Drama
                            + "|" + (int) TMDBConstants.Genres.Action + "|" + (int) TMDBConstants.Genres.SciFi,
                urlBuilder.BuiltURL);


        }
コード例 #10
0
 public WebDataService(IWebConnection connection, IWebDataReader reader, IURLBuilder urlBuilder)
 {
     this.connection = connection;
     this.reader = reader;
     this.urlBuilder = urlBuilder;
 }
コード例 #11
0
 public OpenWeatherDownloader(IURLBuilder urlBuilder)
 {
     URLBuilder = urlBuilder;
 }
コード例 #12
0
 public WebDataService(IWebConnection connection, IWebDataReader reader, IURLBuilder urlBuilder)
 {
     this.connection = connection;
     this.reader     = reader;
     this.urlBuilder = urlBuilder;
 }