public void T020_AllForLegislator_FirstOnList() { // first, read all legislators var legislators_req = new Legislators(ConfigData.API_KEY); var legislators_result = legislators_req.GetList(false); Assert.IsTrue(legislators_result.Count() > 0, "Legislators.GetList failed to return even one current legislator"); // read all committee memberships, allowing an error to occur bool ok = false; foreach (var legislator in legislators_result) { var name = legislator.firstname + " " + legislator.lastname; try { // now read the committee membership for legislator var req = new Committees(ConfigData.API_KEY); var result = req.AllForLegislator(legislator.bioguide_id); Assert.Greater(result.Count(), 0, "AllForLegislator failed to return values for " + name); ok = true; break; } catch (Infrastructure.ErrorException) { // this is OK System.Console.WriteLine("Failed reading data for " + name + " (retrying)"); } } if (!ok) { Assert.Fail("Could find no committee memberships in the entire house"); } }
public void T040_AllForLatLong_22079() { var req = new Legislators(ConfigData.API_KEY); var result = req.AllForLatLong(38.695, -77.214); Assert.IsTrue(result.Count() > 0, "AllForLatLong failed for 38.695, -77.214"); // ZIP 220789 should contain at least as many var result2 = req.AllForZip("22079"); Assert.IsTrue(result2.Count() >= result.Count(), "AllForLatLong didn't return matching value for AllForZip (22079)"); }
public void T030_AllForZip_22079() { var req = new Legislators(ConfigData.API_KEY); var result = req.AllForZip("22079"); Assert.IsTrue(result.Count() > 0, "AllForZip failed for 22079"); }
public void T020_Search_BarackObama() { var req = new Legislators(ConfigData.API_KEY); var result = req.Search(true, "barack"); Assert.IsTrue(result.Count() > 0, "Search failed for Barack"); }
public void T010_Get_LastName_Obama() { var req = new Legislators(ConfigData.API_KEY); var result = req.Get(true, Legislator.Props.lastname, "obama"); Assert.IsTrue(result != null, "Get failed for obama"); }
public void T001_GetList_AllCurrent() { var req = new Legislators(ConfigData.API_KEY); var result = req.GetList(false); Assert.IsTrue(result.Count() > 0, "GetList failed for currently elected legislators"); }