Exemple #1
0
        public void CanGetDistricts()
        {
            TaskForceApi api = new TaskForceApi();

            var result = api.GetAllDistricts("burkina faso");
            
            Assert.IsTrue(result.WasSuccessful);
        }
 private void TaskForceCountryStep_Load(object sender, EventArgs e)
 {
     if (!DesignMode)
     {
         Localizer.TranslateControl(this);
         country = demo.GetCountry();
         if (!string.IsNullOrEmpty(country.TaskForceName))
             DoNextStep();
         TaskForceApi api = new TaskForceApi();
         var taskForceCountries = api.GetAllCountries();
         var tfCountry = taskForceCountries.FirstOrDefault(c => c.Name == country.Name);
         if (tfCountry != null)
         {
             country.TaskForceName = tfCountry.Name;
             var userId = ApplicationData.Instance.GetUserId();
             demo.UpdateCountry(country, userId);
             DoNextStep();
         }
         adminUnitMatcher1.BindData(new AdminLevel { Name = country.Name }, taskForceCountries);
     }
 }
 void worker_DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         TaskForceApi api = new TaskForceApi();
         e.Result = api.GetAllDistricts((string)e.Argument);
     }
     catch (Exception ex)
     {
         Logger log = new Logger();
         log.Error("Error fetching country information from task force api. TaskForceCountryStep (worker_DoWork). ", ex);
         e.Result = new TaskForceApiResult { WasSuccessful = false, ErrorMsg = Translations.UnexpectedException + " " + ex.Message };
     }
 }