public void GetTopMakelaars_2() { List <CKoopWoning> oWoningen = new List <CKoopWoning>(); CAPI_TestData oAPI = new CAPI_TestData(); IAPIParser_KoopWoningParser oParser = new CAPIParser_KoopWoningXML(); IGet_TopNMakelaars oReport = new CGet_TopNMakelaars(oAPI, oParser); List <CMakelaar> oMakelaars; // 3 Houses oWoningen.Add(new CKoopWoning("a", 1, "Makelaar_1")); oWoningen.Add(new CKoopWoning("b", 2, "Makelaar_2")); oWoningen.Add(new CKoopWoning("c", 1, "Makelaar_1")); oAPI.AddData(1, 25, CreateXML(oWoningen.Count, oWoningen)); oAPI.AddData(2, 25, CreateXML(0, new List <CKoopWoning>())); oMakelaars = oReport.GetTopNMakelaars("/amsterdam/", 2); Assert.AreEqual(oMakelaars.Count, 2, "GetTopMakelaars 'Top 2' Failed"); Assert.AreEqual(oMakelaars[0].MakelaarID, 1, "GetTopMakelaars 'Top 2' Failed"); Assert.AreEqual(oMakelaars[0].MakelaarName, "Makelaar_1", "GetTopMakelaars 'Top 2' Failed"); Assert.AreEqual(oMakelaars[0].NumWoningen, 2, "GetTopMakelaars 'Top 2' Failed"); Assert.AreEqual(oMakelaars[1].MakelaarID, 2, "GetTopMakelaars 'Top 2' Failed"); Assert.AreEqual(oMakelaars[1].MakelaarName, "Makelaar_2", "GetTopMakelaars 'Top 2' Failed"); Assert.AreEqual(oMakelaars[1].NumWoningen, 1, "GetTopMakelaars 'Top 2' Failed"); }
public void GetKoopWoningen_0() { List <CKoopWoning> oWoningen = new List <CKoopWoning>(); List <CKoopWoning> oResult; IAPIParser_KoopWoningParser oParser = new CAPIParser_KoopWoningXML(); // 0 Houses oResult = oParser.ParseAPIData(CreateXML(oWoningen.Count, oWoningen)); Assert.AreEqual(oWoningen.Count, oResult.Count, "GetKoopWoningen '0 Houses' Failed"); }
public void GetTopMakelaars_0() { List <CKoopWoning> oWoningen = new List <CKoopWoning>(); CAPI_TestData oAPI = new CAPI_TestData(); IAPIParser_KoopWoningParser oParser = new CAPIParser_KoopWoningXML(); IGet_TopNMakelaars oReport = new CGet_TopNMakelaars(oAPI, oParser); List <CMakelaar> oMakelaars; oAPI.AddData(1, 25, CreateXML(oWoningen.Count, oWoningen)); oMakelaars = oReport.GetTopNMakelaars("/amsterdam/", 10); Assert.AreEqual(oMakelaars.Count, 0, "GetTopMakelaars '0 Houses' Failed"); }
public void GetKoopWoningen_3() { List <CKoopWoning> oWoningen = new List <CKoopWoning>(); List <CKoopWoning> oResult; IAPIParser_KoopWoningParser oParser = new CAPIParser_KoopWoningXML(); // 3 Houses oWoningen.Add(new CKoopWoning("a", 1, "Makelaar_1")); oWoningen.Add(new CKoopWoning("b", 2, "Makelaar_2")); oWoningen.Add(new CKoopWoning("c", 1, "Makelaar_1")); oResult = oParser.ParseAPIData(CreateXML(oWoningen.Count, oWoningen)); Assert.AreEqual(oWoningen.Count, oResult.Count, "GetKoopWoningen '3 Houses' Failed"); for (int i = 0; i < oWoningen.Count - 1; i++) { Assert.AreEqual(oWoningen[i].WoningID, oResult[i].WoningID, "GetKoopWoningen '3 Houses' Failed"); Assert.AreEqual(oWoningen[i].MakelaarID, oResult[i].MakelaarID, "GetKoopWoningen '3 Houses' Failed"); Assert.AreEqual(oWoningen[i].MakelaarName, oResult[i].MakelaarName, "GetKoopWoningen '3 Houses' Failed"); } }
// Get the top N makelaars using the API and output to the console static void Main(string[] args) { // Get API URL and Key from config file string APIURL = ConfigurationManager.AppSettings.Get("APIURL"); string APIKEY = ConfigurationManager.AppSettings.Get("APIKEY"); IAPI_GetKoopWoningen oAPI = new CAPI_GetKoopWoningen(APIURL, APIKEY); IAPIParser_KoopWoningParser oParser = new CAPIParser_KoopWoningXML(); IGet_TopNMakelaars oReport = new CGet_TopNMakelaars(oAPI, oParser); IDisplay_TopNMakelaar oDisplay = new CDisplay_TopNMakelaarConsole(); List <CMakelaar> oMakelaars; oDisplay.Starting("Retrieving information.Please wait...\n"); oMakelaars = oReport.GetTopNMakelaars("/amsterdam/", 10); oDisplay.DisplayTopNMakelaar(oMakelaars, "Top 10 Makelaars in Amsterdam:"); oMakelaars = oReport.GetTopNMakelaars("/amsterdam/tuin/", 10); oDisplay.DisplayTopNMakelaar(oMakelaars, "Top 10 Makelaars in Amsterdam with tuin:"); oDisplay.Done(); }