Пример #1
0
        public void TestYear()
        {
            DriverService driverService      = new DriverService();
            string        selectedYearString = "1957";
            string        urlConstructors    = @"http://ergast.com/api/f1/" + selectedYearString + "/constructorstandings.json";

            Assert.True(driverService.GetConstructors(urlConstructors) == null);
        }
Пример #2
0
        public void TestMethods()
        {
            DriverService driverService      = new DriverService();
            string        selectedYearString = "1950";
            string        urlDrivers         = @"http://ergast.com/api/f1/" + selectedYearString + "/driverstandings.json";
            string        urlConstructors    = @"http://ergast.com/api/f1/" + selectedYearString + "/constructorstandings.json";

            driverService.GetDrivers(urlDrivers);
            driverService.GetConstructors(urlConstructors);
        }
Пример #3
0
        private void ButtonShowResults_Click(object sender, RoutedEventArgs e)
        {
            string selectedYearString = ComboBoxSelectYear.SelectedItem.ToString();

            int.TryParse(selectedYearString, out int selectedYear);
            if (selectedYear < 1958)
            {
                MessageBox.Show("Note: There was no constructors championship until 1958, so no constructors will be shown!");
            }

            string urlDrivers      = @"http://ergast.com/api/f1/" + selectedYearString + "/driverstandings.json";
            string urlConstructors = @"http://ergast.com/api/f1/" + selectedYearString + "/constructorstandings.json";

            driverService.GetDrivers(urlDrivers);
            driverService.GetConstructors(urlConstructors);
            viewModel   = new ViewModel();
            DataContext = viewModel;
        }